JPEG图像的第二和第三字节是否始终是APP0或APP1标记? [英] Is the 2nd and 3rd byte of a JPEG image always the APP0 or APP1 marker?

查看:366
本文介绍了JPEG图像的第二和第三字节是否始终是APP0或APP1标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经测试了一些不同的JPEG图像.据我所知,第0个字节和第一个字节始终是0xFF0xD8.

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.

第二个和第三个通常是0xFF0xE0(APP0),表示JFIF段或JFIF扩展段,或者0xFF0xE1(APP1),表示EXIF段.

The second and third are usually either 0xFF and 0xE0 ( APP0 ) indicating either a JFIF segment or JFIF extension segment or 0xFF and 0xE1 ( APP1 ) indicating an EXIF segment.

我的问题:总是这样吗?第二和第三字节始终是APP0还是APP1?

My question: is this always the case? Are the 2nd and 3rd bytes always APP0 or APP1?

推荐答案

否.有例如不使用这些标记或使用其他APP标记创建JPEG的几台相机.您唯一可以依靠的是SOI序列FF D8,甚至不是所有相机都产生EOI.另外请注意,存在具有嵌入JPEG的JPEG-您可以在图像中嵌套SOI/EOI.

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.

如果您需要处理原始相机图像中的嵌入式JPEG数据,则有些模型会生成类似JPEG的数据,这些数据只能通过jpeg规范稍稍松弛才能进行解析-尤其是与数据中转义的FF字节有关.然后,您的相机就会产生专有数据,乍一看看起来像jpeg数据(例如,索尼的某些加密"原始格式)

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)

这篇关于JPEG图像的第二和第三字节是否始终是APP0或APP1标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆