Search code examples
macospng

Can a PNG image contain multiple pages?


On OSX I converted a multi-page PDF file to PNG and (somehow) it created a multi-page PNG file.

enter image description here

Is there an extension to the PNG format that allows this? Or is this not something I can validly create?

~~~~

To clarify, this is a PNG file, per the builtin file command and the identify command from imagemagick.

$ file algorithms-combined-print.png 
algorithms-combined-print.png: PNG image data, 1275 x 1650, 8-bit/color RGBA, non-interlaced

$ identify algorithms-combined-print.png 
algorithms-combined-print.png PNG 1275x1650 1275x1650+0+0 8-bit sRGB 3.537MB 0.000u 0:00.000

And here is a pastebin of the command identify -verbose algorithms-combined-print.png: http://pastebin.com/hw1yuRKa

What is notable from that output is that the pixel count is Number pixels: 2.104M which corresponds to one page. However, the file size is 3.537MB, which is clearly sufficient to hold all the pages.

Per request, here is the output of pngcheck: http://pastebin.com/aCRMEd9L


Solution

  • PNG does not support "multipage" images.

    MNG is a PNG variant that supports multiple images - mostly for animations, but it's not a real PNG image (diffent signature/header), and has never become popular.

    APNG is a similar attempt, but more focused on animations - it's more popular and alive, though it's less official - it's also PNG compatible (a standard PNG viewer, unaware of APNG, will display it as a single PNG image).

    Another possible explanation is that your image is actually a TIFF image with a wrong .png extension, and the viewer ignores it.

    The only way to know for sure is to look inside the image file itself (at least to the first bytes)

    Update: given the pngcheck output, it seems to be a APNG file.