hexscope
Open a file

Broken files

Why won't my PNG open?

When a viewer refuses a PNG, it rarely says why. The cause is almost always one of five things, and each one leaves a mark in the file's bytes. hexscope reads a broken file anyway, in your browser, and points at the exact place.

Check a PNG Try a broken image

1 It is not really a PNG

A file named .png can be a JPEG, a WebP or an iPhone's HEIC photo that was renamed, or saved under the wrong name by a website. Programs that trust the name fail. Every PNG starts with the same eight bytes, 89 50 4E 47 0D 0A 1A 0A; if those are missing, hexscope names the format the file really is, and opens it as that when it can.

Fix: give it the right extension, or open it with a program that reads what it really is.

2 It was cut short

A download that stopped early, a copy to a full disk, a card pulled out too soon: the file simply ends. A PNG is a run of chunks, each with its length, and it must finish with one called IEND. hexscope shows the last chunk that is whole, the one that is cut, and that IEND never arrives.

Fix: get the file again. What is missing cannot be rebuilt.

3 It went through a text-mode transfer

Some old transfer programs — FTP in ASCII mode is the classic — treat every file as text and change its line endings on the way. The signature's 0D 0A and 0A bytes are there to catch exactly this: when they come out changed, the file was altered as text, and so was everything after. hexscope reports a damaged PNG signature and reads on, so you can see the damage that follows.

Fix: transfer the file again in binary mode.

4 Bytes were changed

Every chunk ends with a CRC-32, a checksum of its type and data. A single flipped bit — a failing disk, a faulty edit, a careless tool — makes it disagree. hexscope marks every mismatch with the stored and the computed value, on the four bytes of the checksum, so you can see which chunk was hit. Some viewers refuse a file for a bad checksum in a vital chunk even when the rest is fine.

Fix: get a good copy if you can. When the damage is only in the checksum, a program that recomputes it may rescue the file.

5 The compressed pixels are broken

The picture is stored in IDAT chunks, compressed with DEFLATE — the same compression as ZIP. When those bytes are damaged, decompression stops part-way, and viewers show nothing, or the top of the picture and then grey. hexscope decompresses the stream step by step and points at the step where it breaks; its player shows everything decoded up to there.

Fix: as with a cut file, only a good copy brings back what is lost.

What hexscope does not do

It does not repair files: it shows you what is wrong, and where, so you know whether a file can be saved and what to ask for. The file stays in your browser; nothing is uploaded.

Check a PNG now

The format is the W3C's PNG specification; its signature is there to tell PNGs from other files and to catch some transmission errors early.