开发者

JPEG file size markers, inserting bytes, IPTC metadata

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?开发者_Python百科 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.


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 :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜