What is the maximum size of JPEG metadata?

后端 未结 3 781
心在旅途
心在旅途 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:30

    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.

提交回复
热议问题