Is the 2nd and 3rd byte of a JPEG image always the APP0 or APP1 marker?

前端 未结 8 971
失恋的感觉
失恋的感觉 2020-12-10 17:18

I have a few different JPEG images I\'ve been testing with. As far as I\'ve seen the 0th and first bytes are always 0xFF and 0xD8.

The s

8条回答
  •  無奈伤痛
    2020-12-10 17:38

    No. There are e.g. several cameras that create JPEGs without these markers, or with other APP markers. The only thing you can rely on is the SOI sequence, FF D8, not even EOI is produced by all cameras. Also be aware that JPEGs with embedded JPEGs exist - you can have nested SOI/EOI within an image.

    If you need to deal with embedded JPEG data in raw camera images, several models produce JPEG-like data that can only be parsed by being a bit slack with the jpeg spec - especially in relation to escaped FF bytes in data. And then you have cameras that produce proprietary data that at first glance looks like jpeg data (e.g. some of Sony's "encrypted" raw formats)

提交回复
热议问题