Binary JPG Creator
Convert raw binary or hexadecimal data into real JPG images. Map bytes to pixels with grayscale, RGB, or RGBA color modes and export high-quality JPEG files.
About
Every JPG file is a grid of pixels encoded as bytes. This tool reverses the abstraction: you supply raw binary (0s and 1s) or hexadecimal values, and the engine maps each byte (or bit) directly onto a canvas pixel grid. In bit-per-pixel mode, a single 0 renders black and 1 renders white. In grayscale mode, each 8-bit byte maps to a luminance value from 0 (black) to 255 (white). In RGB mode, every 3 consecutive bytes define one pixel's red, green, and blue channels. Incorrect byte alignment or dimension mismatch produces visual artifacts or data truncation - the tool warns you when your input length does not evenly fill the specified grid.
The output is a genuine JPEG file produced by the browser's native Canvas encoder at a configurable quality factor Q from 0.01 to 1.0. This is not a renamed text file or a simulated preview. The resulting binary matches the JFIF specification and opens in any image viewer. Useful for forensic data visualization, steganography experiments, embedded firmware inspection, or simply understanding how digital images are constructed at the byte level. Note: JPEG compression is lossy - pixel values in the decoded file may differ from your input by ±1 - 3 levels due to DCT rounding.
Formulas
The core operation converts a linear byte array into a 2D pixel grid. Each pixel's position is derived from its index in the data stream:
where i = pixel index (zero-based), W = image width in pixels. For grayscale mode, each byte b maps to an RGBA quad:
For RGB mode, three consecutive bytes define one pixel:
Binary-to-byte conversion uses standard positional notation:
Auto-dimension calculation when only total pixel count N is known: W = ceil(√N), then H = ceil(NW). Pixels beyond the data length are filled with 0 (black).
JPEG quality parameter Q controls the quantization step in the DCT (Discrete Cosine Transform) stage. Lower Q increases quantization divisors, discarding high-frequency coefficients. The relationship between Q and file size is nonlinear.
Reference Data
| Color Mode | Bytes per Pixel | Channel Mapping | Value Range | Use Case |
|---|---|---|---|---|
| Bit (1-bit) | 0.125 (1 bit) | 0 → Black, 1 → White | 0 - 1 | Binary visualization, barcodes |
| Grayscale | 1 | Byte → R=G=B | 0 - 255 | Firmware dumps, entropy maps |
| RGB | 3 | B1→R, B2→G, B3→B | 0 - 255 per channel | Color data inspection |
| RGBA | 4 | B1→R, B2→G, B3→B, B4→A | 0 - 255 per channel | Transparency-aware renders |
| JPEG Quality vs File Size Reference | ||||
| Quality 1.0 | Maximum fidelity, largest file | Archival, pixel-exact work | ||
| Quality 0.8 | ~30% smaller than 1.0 | General purpose | ||
| Quality 0.5 | ~60% smaller than 1.0 | Web thumbnails | ||
| Quality 0.1 | ~90% smaller, heavy artifacts | Placeholder images | ||
| Common Binary Patterns | ||||
| 00000000 | Decimal 0 | Pure black pixel (grayscale) | ||
| 11111111 | Decimal 255 | Pure white pixel (grayscale) | ||
| 10000000 | Decimal 128 | Mid-gray pixel | ||
| 11111111 00000000 00000000 | RGB(255,0,0) | Pure red pixel (RGB mode) | ||
| 00000000 11111111 00000000 | RGB(0,255,0) | Pure green pixel (RGB mode) | ||
| 00000000 00000000 11111111 | RGB(0,0,255) | Pure blue pixel (RGB mode) | ||
| Hex Equivalents | ||||
| FF | Decimal 255 | White / max channel | ||
| 00 | Decimal 0 | Black / min channel | ||
| 80 | Decimal 128 | 50% intensity | ||
| FF0000 | RGB red | 3-byte red pixel | ||
| 7F7F7F | RGB mid-gray | Neutral gray | ||