PNG file is invalid or unsupported on Mac: fixes that work
When Preview says a PNG “may be damaged or use a file format that Preview doesn’t recognize”, the most likely explanation is that it is not a PNG: a WebP, AVIF, SVG or HEIC file with a .png extension is far more common than a damaged PNG. The second most common is a file that was cut short during a download. Run file on it to see what it actually is, rename or convert it if the extension is wrong, and for a real PNG check its size and ending before deciding whether any image data is recoverable.
Step 1: find out what the file really is
PNG is one of the most robust image formats, so a genuinely corrupted PNG is rare. Open Terminal, type file with a trailing space, drag the image into the window and press Return:
file ~/Downloads/diagram.png
What the answer means:
- “PNG image data, 1920 x 1080, 8-bit/color RGBA”: a real PNG with a readable header. Go to Step 3.
- “RIFF … Web/P image”: a WebP. Very common for images saved from websites. Recent macOS versions open WebP in Preview; older ones do not. Rename it to .webp and try, or see how to convert WebP to JPEG on a Mac.
- “ISO Media, AVIF Image”: an AVIF. Same story; see how to convert AVIF images to JPEG on a Mac.
- “SVG Scalable Vector Graphics image” or “XML document”: a vector file. Rename to .svg and open it in Safari or an editor.
- “JPEG image data”: rename to .jpg.
- “HTML document”: the download failed and the server gave you an error page. Download it again.
- “data” or “empty”: the header is gone or the file is zero bytes. Step 4.
Renaming the extension to match what file reports fixes the majority of “invalid PNG” complaints in one step.
Step 2: convert a mislabeled image to a real PNG
If the file is a WebP, AVIF, HEIC, BMP or TIFF and you need an actual PNG (for an upload form, a document, or an app that checks the header), convert it rather than rename it.
sips ships with macOS and handles the formats the system can decode:
sips -s format png ~/Downloads/diagram.webp --out ~/Downloads/diagram.png
On older macOS versions sips cannot read WebP or AVIF. Manatee decodes those with its own bundled engine regardless of macOS version (macOS 12 or later), so drag the file onto its menu bar icon or into its window, pick PNG or JPEG, and it writes a new file beside the original. It handles a folder of mixed images in one drop. What it does not do is repair a PNG whose data is damaged: Manatee’s Repair mode covers video, PDF and Word documents, not images, and if a PNG cannot be decoded, Convert will say so rather than write a blank picture. It runs on your Mac with no upload, free for 24 hours with every feature, then $9 once.
Step 3: a real PNG that still will not open
If file reports a proper PNG and Preview still refuses, work through these.
- Try another viewer. Select the file and press Space for Quick Look, drag it into a browser window, or open it with Photos. Browser decoders tolerate minor chunk errors that Preview rejects.
- Check the size. Press Command+I. A screenshot is typically hundreds of kilobytes to a few megabytes. A file of a few kilobytes that claims 1920 by 1080 was truncated.
- Check the ending. A complete PNG ends with an IEND chunk. In Terminal:
tail -c 12 ~/Downloads/diagram.png | xxd
The last bytes should read 49 45 4e 44 ae 42 60 82 (IEND followed by its checksum). If they do not, the file was cut short. PNG decodes top to bottom in compressed rows, so a truncated PNG usually renders the top portion and stops; some viewers show that portion, others refuse the whole file. A browser is the most likely to show what is there.
4. Re-save it with sips. If a viewer can decode it, sips -s format png in.png --out out.png writes a clean file with correct checksums and a proper IEND, which fixes a PNG that was merely malformed rather than missing data.
Step 4: the iOS-optimized PNG case
PNGs pulled out of an iPhone or iPad app bundle, or from some screenshot and backup tools, are often in Apple’s private CgBI variant: the color channels are stored in a different order and the compression lacks standard headers. Preview and most apps reject them as invalid even though they are complete.
The fix is to revert them to standard PNG. If you have Xcode or its command line tools installed:
xcrun pngcrush -revert-iphone-pngs ~/Downloads/icon.png ~/Downloads/icon-fixed.png
You can confirm a CgBI file by looking at the first chunk after the header:
head -c 40 ~/Downloads/icon.png | xxd
A standard PNG shows IHDR at byte 12. A CgBI file shows CgBI there instead.
Step 5: when the PNG is truncated or zero bytes
A zero-byte PNG contains nothing, and no tool can repair it. A truncated PNG contains the top rows and nothing below them. What you can do:
- Look for another copy: the app that made it, a cloud folder’s version history, Time Machine, the original screenshot in Photos, the website it came from.
- Recover the rows that exist by opening it in a browser and taking a screenshot of the rendered portion.
- Re-export from the source. Diagrams, charts and screenshots can usually be regenerated far faster than a damaged file can be coaxed back.
The principle applies across formats: data that never reached the disk cannot be rebuilt. Why files get corrupted and what can actually be recovered explains the limits in more detail.
Preventing it
Most invalid PNGs come from the web, where servers send one format and name it another, and from interrupted downloads. Save images with File, Save As in the browser rather than dragging from the page, which sometimes saves a placeholder; wait for a download to finish before opening it; and when a site offers a download button, prefer it over right-click, since the button usually serves the original file rather than a converted preview.
Questions
Preview opens the PNG but the colors are wrong or the transparency is black.
That is usually a 16-bit or unusual color-profile PNG, or a CgBI file that one viewer tolerated. Re-saving with sips (Step 3) normalizes it. If transparency matters, check the output in a browser, which shows the checkerboard properly.
The PNG opens on Windows but not on my Mac.
Check file first; Windows often hides extensions and the file may be a WebP or BMP. If it is a real PNG, a browser on the Mac will almost certainly open it, and a sips re-save will produce a version Preview accepts.
Can a PNG carry a virus, and is that why it is blocked? macOS does not block image files for that reason. “Invalid” from Preview is about the file’s structure, not security. If Gatekeeper shows a warning, that concerns an app, not an image.
Does converting the PNG to JPEG fix the error?
Only if a decoder can read the PNG in the first place. If it can, converting with sips or Manatee produces a clean file. If nothing can decode it, conversion cannot help.