Adding IPTC to JPEG file using markers and segments

Started by yosh, October 16, 2012, 09:03:26 AM

Previous topic - Next topic

Phil Harvey

Quote from: yosh on November 06, 2012, 07:48:31 AM
Should I only overwrite edited IPTC fields or read the entire IPTCData to array/map and then substitute the whole segment in file. I guess I have to take the 2nd option to make less operations on file.

I don't see how 1 would work unless you can guarantee that the information doesn't change length.

QuoteAbout Photoshop IRB I only wondered if the information is duplicated in EXIF or JFIF segments or is there anything very specific that might damage or decrease the informational value of file if deleted.

None of the information in the Photoshop IRB is duplicated elsewhere, with the exception of the image resolution.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

yosh

Quote from: Phil Harvey on November 06, 2012, 10:53:09 AM
Quote from: yosh on November 06, 2012, 07:48:31 AM
Should I only overwrite edited IPTC fields or read the entire IPTCData to array/map and then substitute the whole segment in file. I guess I have to take the 2nd option to make less operations on file.

I don't see how 1 would work unless you can guarantee that the information doesn't change length.

I actually made it work before, just have to change all 3 length words. But it was only good for changing one IPTC record at a time. Well, nevermind.

Quote from: Phil Harvey on November 06, 2012, 10:53:09 AM
None of the information in the Photoshop IRB is duplicated elsewhere, with the exception of the image resolution.

I really hate the JPEG/IPTC/Adobe documentation...
If I want to keep all other APP13 segments, then I have to scan APP13 for Photoshop 3.0\x00 header and if it exists parse each 8BIM record and it's length word, right?

Sorry for so many questions, it's hard to find some good advice in this topic.

Phil Harvey

Quote from: yosh on November 08, 2012, 07:15:38 AM
I really hate the JPEG/IPTC/Adobe documentation...

Yeah, especially the Adobe PSD documentation.  They make you sign a non-disclosure agreement to get the documentation, but this agreement is incompatible with open source software, so I can't use it.

QuoteIf I want to keep all other APP13 segments, then I have to scan APP13 for Photoshop 3.0\x00 header and if it exists parse each 8BIM record and it's length word, right?

Yes.  You should consult my ProcessPhotoshop() function in lib/Image/ExifTool/Photoshop.pm.  I have seen block types of other than just "8BIM" used in this data.  I'm not sure if they are documented because as I said the documentation is off limits to me.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

yosh

Hi, just wanted to thank you again for your help! I managed to write an IPTC editor class for my Java and .NET applications and your instructions were very helpful.

It's still very early version, probably with some bugs I've yet to find, but it works on every JPEG image I've tried so far (with or without APP13, 8BIM and IPTC). After improving current code, my next goal is to bind IPTC to XMP fields. Wish me luck :) I hope you don't mind if I bring back this thread sometime later if I still have some problems or need an advice...

Mike

Phil Harvey

Hi Mike,

Great, glad you're having some success.  Please do keep us updated with your progress.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).