File format limits in pixel size for png images?

女生的网名这么多〃 提交于 2019-12-04 00:42:16

问题


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.


回答1:


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




回答2:


That is an odd image, but I am sure there is a reason to have such a huge image.

I can't really address the size limit, but I can address a way to get around it. Create a set of tiles of some size, and then as the user scrolls, bring tiles into view using CSS to position them correctly. You might even be able to get away with bringing up all the tiles at once, with a slew of smaller images.

But I am curious, what is the application that needs such a huge image displayed without scaling out?

Erick



来源:https://stackoverflow.com/questions/4109447/file-format-limits-in-pixel-size-for-png-images

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!