jpeg header 结构中宽高的位置

Position of width and height in jpeg header structure

我正在尝试解析 jpeg header,其中我需要框架的宽度和高度。我浏览了很多链接,但仍然不清楚结构。如果有人对此有具体的想法,请分享。

谢谢

这不是那么简单。如果您看到 "FF D8 FF E0" 作为前几个字节,则使用 JPEG File Interchange Format which is as simple as casting the header to a struct. Looking at my own .jpg files though.. they all start with "FF D8 FF E1" which means they use Exchangeable Image File Format, which seems to be a bit harder. You can find a library for doing that here.

图像(又名帧)尺寸位于 SOF 标记中。您正在寻找:

FFC0, 
FFC1, or
FFC2

请在此处查看幻灯片 10 的结构

http://lad.dsc.ufcg.edu.br/multimidia/jpegmarker.pdf

这些值是大端,因此您可能需要反转系统上的字节。