Binary to Image Converter
Convert binary data (0s and 1s or raw bytes) into visual images. Supports grayscale, RGB, RGBA, and 1-bit modes with PNG export.
About
Raw binary data has no inherent visual form. This tool maps byte sequences to pixel values on a canvas, producing a faithful raster image from any binary input. In 1-bit mode each bit becomes a black or white pixel. In grayscale mode each byte (0 - 255) maps to a single luminance pixel. In RGB mode every 3 bytes define one pixel's red, green, and blue channels. Width is configurable; height derives from Nw where N is the total pixel count. The output is a lossless PNG suitable for forensic analysis, steganography research, or data-art projects.
Misconfiguring width produces diagonal banding artifacts that obscure structure. Choosing the wrong color mode shifts byte alignment and corrupts the visual. This converter auto-detects sensible defaults but exposes every parameter so you can match the source format exactly. Note: the tool approximates square dimensions when no width is specified. For non-square data, set width manually to match the original raster stride.
Formulas
The core mapping converts a linear byte array into a 2D pixel grid. Given N total pixels (determined by byte count and color mode) and a chosen width w:
For auto-width when no value is specified:
Pixel count N depends on the color mode and total byte count B:
Each pixel at position i maps to canvas coordinates:
Where B = total bytes in input, N = total pixel count, w = image width in pixels, h = image height in pixels, i = linear pixel index.
Reference Data
| Color Mode | Bytes per Pixel | Channels | Value Range | Typical Use |
|---|---|---|---|---|
| 1-Bit (B&W) | 18 | 1 | 0 or 1 | Fax, barcodes, QR internals |
| Grayscale | 1 | 1 | 0 - 255 | Firmware dumps, entropy maps |
| RGB | 3 | 3 | 0 - 255 each | Raw framebuffers, BMP payloads |
| RGBA | 4 | 4 | 0 - 255 each | Transparent textures, iOS assets |
| Common File Signatures (Magic Bytes) | ||||
| PNG | 89 50 4E 47 | First 4 bytes: 137 80 78 71 decimal | ||
| JPEG | FF D8 FF | First 3 bytes: 255 216 255 | ||
| GIF | 47 49 46 38 | ASCII: GIF8 | ||
| BMP | 42 4D | ASCII: BM | ||
| 25 50 44 46 | ASCII: %PDF | |||
| ZIP | 50 4B 03 04 | PK header | ||
| Pixel Scale Reference | ||||
| 1Γ | 1 data pixel = 1 screen pixel | Actual size, may be tiny | ||
| 4Γ | 1 data pixel = 4Γ4 block | Good for <256 byte files | ||
| 8Γ | 1 data pixel = 8Γ8 block | Good for <64 byte files | ||
| 16Γ | 1 data pixel = 16Γ16 block | Poster/print quality for small data | ||