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

前端 未结 8 972
失恋的感觉
失恋的感觉 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:27

    In theory, yes. According to the JFIF spec (pdf), its APP0 section should come first in the file. And the Exif spec (pdf) requires the same for its APP1 section.

    But you shouldn't count on the order (or even the existance of) APPn sections; there are crazy JPEG writers out there. Start with the SOI and read the sections as they come by.

提交回复
热议问题