What is the maximum size of JPEG metadata?

后端 未结 3 778
心在旅途
心在旅途 2020-12-16 23:09

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

3条回答
  •  粉色の甜心
    2020-12-16 23:29

    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).

提交回复
热议问题