png 图像的文件格式对像素大小有限制吗?
PNG 像素大小有文件格式限制吗?
我尝试使用 Firefox 可视化 30.000x30.000 像素的 PNG 图像,但出现错误。图像在 Preview.app 中正确打开,尽管速度非常慢。文件大小不大,大约 3 MiB(1 位黑白图像)。我想知道这是否有技术文件格式的原因。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
调整大小的简单实现需要在显示之前将图像大小放大到 2.7GB。对于普通的 32 位程序来说,这显然太大了,无法处理。
PNG 规范似乎没有对图像的宽度和高度施加任何限制;这些是 4 字节无符号整数,最大可达 4294967295。 http://www.libpng.org/pub/png/spec/iso/index-object.html#11IHDR
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
这是一个奇怪的图像,但我确信有一个理由拥有如此巨大的图像。
我无法真正解决大小限制,但我可以找到一种方法来解决它。创建一组一定大小的图块,然后当用户滚动时,使用 CSS 将图块带入视图以正确定位它们。您甚至可以一次性调出所有图块以及大量较小的图像。
但我很好奇,什么应用程序需要在不横向扩展的情况下显示如此巨大的图像?
埃里克
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