Image to Bytes
Read a PNG, JPEG, GIF or WebP as raw bytes and copy the form your code needs: hex, a Uint8Array literal or a C array. Nothing is uploaded.
The file is read as raw bytes in your browser and never uploaded. You get the byte count, hex, a Uint8Array literal and a C array — the forms you paste into code.
When you need this
- You are writing an embedded or firmware test and need the image as a C array, not as a file to load at runtime.
- A test fixture needs the exact bytes of a small image inlined so it does not depend on the filesystem.
- You want to check whether a file really is the format its extension claims, by reading its first bytes rather than trusting the name.
- You are comparing two builds of the same asset and need the byte count and hex to see what changed.
Why other image-to-bytes tools fall short
Most converters hand you Base64 and call it bytes. That is a second encoding on top of the file, not the file — it cannot be pasted into a C array without another decode step.
Tools that format the array by hand drop the leading zero, so 0x04 becomes 0x4 and every following byte shifts. The array still compiles and the image is corrupt.
Converters that decode the image first give you pixels, not the file. A PNG header is not a pixel, and a firmware blob needs the bytes exactly as stored.
Frequently asked questions
Are these the bytes of the file, or of the decoded image?
The file, exactly as stored, including its header and any metadata. That is what you need for a C array or a byte-level comparison. Decoding to pixels is a different operation and produces a different array — one where the first bytes are pixel data rather than a PNG signature.
Why does my C array not compile after pasting?
Two usual causes: the array was pasted with the surrounding prose, or the values lost their 0x prefix on one line. This tool emits prefixed, two-digit lowercase hex separated by commas, wrapped at 12 per line, with the length written into the declaration so the compiler can check it.
Is the image uploaded anywhere?
No. The file is read with the browser File API and formatted in the page. There is no request, which also means the page works offline once loaded.
Why is there no option to resize or compress?
Because resizing changes the bytes. This tool is for getting the exact bytes of a file you already have; an image editor is the right place to change what is in it.