need to write to PhotoMechanic fields with Image-ExifTool

Started by Archive, May 12, 2010, 08:54:43 AM

Previous topic - Next topic

Archive

[Originally posted by 190002 on 2009-12-08 19:20:15-08]

Hello all,

First off, thanks for providing Image-ExifTool and peer support.

My company has used Image-ExifTool to extract metadata for years, but now we have been asked to write metadata to JPG files, specifically the PhotoMechanic:Rating and PhotoMechanic:ColorClass attributes.  If a JPG file already has these attributes, then I can modify them with:

exiftool -PhotoMechanic:Rating=2 dst.jpg

However most of our JPG files do not have PhotoMechanic metadata to start with, and in that case the write fails with:

    0 image files updated

    1 image files unchanged

I have tried to copy the entire PhotoMechanic metadata block from an image that has it, to one that does not, with:

exiftool -TagsFromFile photo_mechanic_has_attribs.jpg -PhotoMechanic:all x.jpg

    0 image files updated

    1 image files unchanged

but this also fail to update the file.

Is there any way to write PhotoMechanic metadata to a JPG that does not already have it?  I am happy to use software other than ExifTool if needed (but it has to be command-line, programmable software -- the PhotoMechanic UI won't work for what we need).

Thanks for any help.  Even if the answer is a simple "no that is not supported", that would be very helpful as I could pass that up my chain of command.

Thanks,

James

Archive

<span style="color: gray;"><i>[Originally posted by exiftool on 2009-12-08 23:32:48-08]</i></span>

On the
<a href="https://exiftool.org/index.html#JPEG" target="_blank">JPEG
table of the ExifTool homepage</a> it lists which metadata types
may be created with exiftool.  I think you must be talking about the
PhotoMechanic trailer, which exiftool will not currently create.
PhotoMechanic also has an XMP namespace which may may work
for you:

<div class="codeheader">Code:</div><div class="code"> exiftool -xmp-photomech:Prefs="Tagged:0 ColorClass:0 Rating:2 FrameNum:0"</div>
If this doesn't work, then the only recourse will be the trailer information.
To write this, you must manually copy the photomechanic trailer from
another image.  Once you do this, then you can update the tag with
exiftool.  This is easier than it sounds.  On Unix and Mac you can simply
use "cat" to append a trailer to a file:

<div class="codeheader">Code:</div><div class="code"> cat a.trailer >> image.jpg</div>
This only leaves the slightly tricky part of creating a stand-alone
PhotoMechanic trailer to use for copying.  If you can't do this yourself,
send me an email and I will mail one to you.  My email is philharvey66
at gmail.com

In Windows there may be a slight problem.  The Windows "type" command is
equivalent to "cat", but I would lay odds that Windows will mess with the
newlines in the binary data if you try this.

- Phil

Archive

[Originally posted by 190002 on 2009-12-10 05:03:17-08]

Hi Phil,

Thank you very much for your response (and for creating ExifTool).

This has (tentatively) been resolved for us.  In talking to my management, I learned that they wanted to be able to read/write the Rating and ColorClass and XMP:Label, regardless of which part of the metadata these were defined in.  So we will not need to create a PhotoMechanic section in each file that does not have one already -- I am happy to just edit the XMP area, or add only the XMP area if needed.

I did see the xmp-photomech:Prefs field, and I guess we'll need to write to it as well to keep everything in sync.

I'm talking with the powers-that-be to firm up the specification of exactly what they want.  If we find ourselves needing a PhotoMechanic trailer, I'll let you know.

Thanks much,

James