JPEG file size markers, byte insertion, IPTC metadata

I am interested in manually entering the IPTC fields in the byte level JPG file. A JPEG file has several metadata segments with respectable size markers. Container segments for IPTC:

App13 - Starts with FF ED XX XX ..

8BIM IPTC Text Metadata - Begin with 38 42 49 4D 04 04 00 00 00 00 XX XX ..

The IPTC field starts with 1C 02 50 XX XX .. (0x50 = 80, IPTC # 80 field).

(XX XX = 2 bytes of a long word describing the size of said segment data).

Are there any other size markers in the JPEG file and metadata to look for? Do I need to increase size when adding a metadata segment with custom IPTC fields?

How to add a custom metadata field (for example, # 225) that will work on all JPEG images that already contain an IPTC segment?

Work in C #, but this is a question about byte operations, so I think the language doesn't matter.

+4
source share
1 answer

Since no one answered, I will explain what I did.

announcement 1. The file labels I mentioned above are enough to manipulate IPTC.

ad 2. During manual IPTC manipulation at the byte level, you can easily corrupt the file if you accidentally delete or overwrite existing bytes, especially if these are markers (headers of any part of the JPEG file).

ad 3. You need to find and increase App13 and the corresponding 8BIM and IPTC tokens with the length of the new metadata field (content size + 5 bytes for the IPTC header). For example, to add a new field No. 09, you must find the 8BIM IPTC segment (38 42 49 4D 04 04 00 00 00 00 XX XX) and increase XX XX bytes with the new word size. Then increase the segment App13 segment (find the last FF ED XX XX segment to 8BIM) and finally, at the end of 8BIM (you know the end thanks to the segment length bytes) you simply add a new IPTC field, for example 1C 02 09 00 05 - adds metadata field No. 09 of length 5. The next 5 bytes will be considered the contents of the field = word to be added.

Yes, this is a bit chaotic, but it works :-)

+2
source

All Articles