JPEG 文件大小标记、插入字节、IPTC 元数据
我对在字节级别手动将 IPTC 字段注入 JPG 文件感兴趣。 JPEG 文件具有多个带有大小标记的元数据段。 IPTC 的分段容器为:
App13 - 以 FF ED XX XX ..
开头
8BIM IPTC 文本元数据 - 以 38 开头42 49 4D 04 04 00 00 00 00 XX XX ..
IPTC 字段以 1C 02 开头50 XX XX ..
(0x50 = 80,IPTC 字段#80)。
(XX XX = 2 个字节的长度字描述上述段数据的大小)。
JPEG 文件中是否还有其他尺寸标记?需要注意的元数据?在附加带有自定义 IPTC 字段的元数据段时,是否必须增加其大小?
如何添加适用于已包含 IPTC 段的所有 JPEG 图像的自定义元数据字段(例如 #225)?
使用 C# 工作,但这是一个关于字节操作的问题,所以我想语言并不重要。
I'm interested in manually injecting IPTC fields into JPG file on bytes level. JPEG file has multiple metadata segments with respectable size markers. The segments-containers for IPTC are:
App13 - starts with FF ED XX XX ..
8BIM IPTC text metadata - starts with 38 42 49 4D 04 04 00 00 00 00 XX XX ..
IPTC field starts with 1C 02 50 XX XX ..
(0x50 = 80, IPTC field #80).
(XX XX = 2 bytes of length-word describing size of mentioned segment data).
Are there any other size markers in JPEG file & metadata to look out for? Do I have to increase their size when appending metadata segment with custom IPTC fields?
How can I add custom metadata field (for example #225) that will work on all JPEG images that already contain IPTC segment?
Working in C# but it's a question about operations on bytes so I guess language doesn't matter.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
既然没有人回复,我就解释一下我做了什么。
广告 1。
我上面提到的文件标记足以操纵 IPTC。
广告 2.
在字节级别的手动 IPTC 操作过程中,如果您意外删除或覆盖现有字节,则可能很容易损坏文件,特别是如果它们是标记(某些 JPEG 文件部分的标头)。
ad 3. 必须找到并增加 App13 以及适当的 8BIM 和 IPTC 标记以及新元数据字段的长度(内容大小 + IPTC 标头的 5 字节)。例如,要添加新字段 #09,您必须找到 8BIM IPTC 段 (38 42 49 4D 04 04 00 00 00 00 XX XX) 并使用新字大小增加 XX XX 字节。然后增加包装 App13 段(在 8BIM 之前找到最后一个 FF ED XX XX 段)大小,最后在 8BIM 末尾(由于段长度字节,您知道结束),您只需添加新的 IPTC 字段,如 1C 02 09 00 05 -添加长度为 5 的元数据字段 #09。以下 5 个字节将被视为字段内容 = 您添加的单词。
是的,有点混乱,但有效:-)
Since nobody replied I'll explain what I did.
ad 1.
The file markers I mentioned above are enough to manipulate IPTC.
ad 2.
During manual IPTC manipulation on bytes' level you may easily damage file if you accidently remove or overwrite existing bytes, especially if they're markers (headers of some JPEG file part).
ad 3. One has to find and increase App13 and appropriate 8BIM and IPTC markers with the lenght of new metadata field (content size + 5 bytes for IPTC header). So for example to add new field #09 you have to find 8BIM IPTC segment (38 42 49 4D 04 04 00 00 00 00 XX XX) and increase XX XX bytes with new word size. Then increase the wrapping App13 segment (find last FF ED XX XX segment before 8BIM) size and finally at the end of 8BIM (you know the end thanks to the segment lenght bytes) you just add new IPTC field like 1C 02 09 00 05 - adds metadata field #09 of length 5. The following 5 bytes will be considered a field content = the word you add.
Yeah it's a little chaotic but works :-)