File format limits in pixel size for png images?

Stefano Borini picture Stefano Borini · Nov 5, 2010 · Viewed 35.3k times · Source

Is there a file format limit to the PNG pixel size?

I am trying to visualize a 30.000x30.000 pixels PNG image with Firefox, but I get an error. The image opens correcly in Preview.app, although very slowly. The file size is not big, just around 3 MiB (1 bit black/white image). I am wondering if there's a technical file-format reason for this.

Answer

Mark Ransom picture Mark Ransom · Nov 5, 2010

A naive implementation of resizing would require the image to be blown up to 2.7GB in size before it is displayed. This would clearly be too large for a normal 32-bit program to handle.

The PNG specification doesn't appear to place any limits on the width and height of an image; these are 4 byte unsigned integers, which could be up to 4294967295. http://www.libpng.org/pub/png/spec/iso/index-object.html#11IHDR