JPEG 元数据的最大大小是多少?
JPEG 文件中可以合并的元数据(EXIF 等)数量是否有理论上的最大值?我想分配一个缓冲区,确保足以保存任何 JPEG 图像的元数据,而无需自己解析它。
Is there a theoretical maximum to the amount of metadata (EXIF, etc) that can be incorporated in a JPEG file? I'd like to allocate a buffer that is assured to be sufficient to hold the metadata for any JPEG image without having to parse it myself.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
理论上没有最大值,因为某些 APP 标记可以多次使用(例如 APP1 用于 EXIF 标头和 XMP 块)。此外,没有什么可以阻止多个评论块。
在实践中,更常见的导致大标头的情况是专门用于存储图像的 ICC 颜色配置文件的 APP2 标记。由于一些复杂的颜色配置文件可能有几兆字节,因此它实际上会被分成许多 APP2 块(因为每个 APP 块都有 16 位寻址限制)。
There is no theoretical maximum, since certain APP markers can be used multiple times (e.g. APP1 is used for both the EXIF header and also the XMP block). Also, there is nothing to prevent multiple comment blocks.
In practice the one that is much more common to result in a large header is specifically the APP2 marker being used to store the ICC color profile for the image. Since some complicated color profiles can be several megabytes, it will actually get split into many APP2 blocks (since each APP block one has a 16bit addressing limit).
每个 APPN 数据区域都有一个 2 字节的长度字段,因此 65536 将容纳最大的长度字段。如果你只是担心 EXIF 数据,那就少一点。
http://www.fileformat.info/format/jpeg/egff.htm
单个文件中最多有 16 个不同的 APPN 标记。我认为它们不能重复,所以 16*65K 应该是理论最大值。
Each APPN data area has a length field that is 2 bytes, so 65536 would hold the biggest one. If you are just worried about the EXIF data, it would be a bit less.
http://www.fileformat.info/format/jpeg/egff.htm
There are at most 16 different APPN markers in a single file. I don't think they can be repeated, so 16*65K should be the theoretical max.
维基百科指出:
Wikipedia states: