ExifTool & Apple Aperture 3

Started by davidrough, February 05, 2012, 06:05:42 PM

Previous topic - Next topic

davidrough

First all thanks Phil for sharing such a great tool !

I never seem to have enough time on my hands so can't really always do as much reading as I would like to on this tool - there seem to be a lot of options harnessing quite a of editing power when it comes to metadata edits however this evening I have spent around 90 minutes trying to develop a work flow so I can go back through my Apple Aperture library and set a couple of tags ("-FocalLength" "-MaxApertureValue" "-Lens") which are missing.

I have tried the following on a couple of small sets (projects) this evening and the results seem to be what I am looking for but before do the rest of my library thought it might be wise to see if I can get a second opinion - I'd hate to mess too much up due to some oversight on my part.

The idea is to correct the data as shown in the attachment. The workflow I have tried is as follows:

1. Set a smart album (as shown in attachment)
2. Use the Export > Master option for all items in Smart Album
3. Export Masters to a subfolder (including the IPTC metadata)
4. from the Command Line run:

exiftool -P -overwrite_original -FocalLength=40 -MaxApertureValue=1.4 -Lens="Voigtländer 40mm f/1.4" -filemodifydate=now -iptcdigest=new /Volumes/Data/Desktop/012912/

5. Which confirms an update such as:

    1 directories scanned
   20 image files updated

6. Delete the contents of the Smart Album (Select All followed by Delete Version)
7. Drop the folder back on to the Project reimporting the photo files back in to their original project.

At this stage the Smart Album which is empty can be deleted.

Sound sensible - sounds simple but these things can and do go wrong for us newbies - plus I'll then feel a lot happier next time I commit these changes to my Aperture Vault.

Anyway thanks again for really cool tool.

Update: Edits go missing ! Any adjustments I have made for example Levels, WB are now gone following import - any way this can be avoided ?

Phil Harvey

I have a few questions:

1) What types of files are we talking about?

2) Is there any other way to use Aperture to store the information you want?

3) Where does Aperture store the edit data?  Does it maintain a separate database?

4) Where does aperture store the image files?  Would it be possible to just copy the updated files into these locations without deleting them in Aperture?  This may preserve the edit information.  But in this case you will need some way to force Aperture to re-load the metadata.  Is there a way to do this?

- 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 ($).

davidrough

Hi Phil,

1) What types of files are we talking about?     

We are talking about JPEGS and RW2 (Panasonic GF1 RAW)

2) Is there any other way to use Aperture to store the information you want?     

Possibly in the comments not sure though.

3) Where does Aperture store the edit data?  Does it maintain a separate database?   

Aperture stores files in its owner pseudo "database" with an undocumented folder structure. It can be browsed but is not designed to be used by anything other than the application itself.


4) Where does aperture store the image files?  Would it be possible to just copy the updated files into these locations without deleting them in Aperture?  This may preserve the edit information.  But in this case you will need some way to force Aperture to re-load the metadata.  Is there a way to do this?

Good question I guess this will be my next avenue of investigation - it appears this is a more Aperture related problem than Exiftool one. An "in-situ" update rather than export/import action may solve this.

Thanks for getting back.... will keep this thread up to date...

David




davidrough

I am delving in to the library and thinking the best approach might be with an -if condition.

I think I know what I need to do - but writing the condition is not proving so easy.

Please see:

exiftool -listx -XMP:All -s _1040524.JPG | grep LensType
LensType                        : LUMIX G 20/F1.7

exiftool -listx -XMP:All -s _1040526.JPG | grep LensType
LensType                        : NO-LENS

I would expect to get one of these files to fail the following condition and the other to pass - PROVIDED my statement were correct HOWEVER both fail:

exiftool  -if "$XMP:LensType eq 'NO-LENS'" _1040524.JPG
    1 files failed condition

exiftool  -if "$XMP:LensType eq 'NO-LENS'" _1040526.JPG
    1 files failed condition

Any ideas where my mistake might be  ?

Thanks.

davidrough

#4
Still reading... come across this similar post:

https://exiftool.org/forum/index.php/topic,3411.msg15355.html#msg15355

Where - I quote  ;)

If the lens is unknown, the name will show up as "Unknown (xx)", or if it is mis-identified the wrong lenstype name will be reported.  You use whatever string is reported for LensType in your -if statement.  Alternatively, you can use the number if you want by appending "#" to the tag name, but it doesn't sound like you want this.

But still not getitng anywhere  :'( - most frustrating !

Any hints ? on what the command is ?

Phil Harvey

Very odd.  The -listx option is for listing the ExifTool tag database in XML form.  I don't think this is what you want to do.  The -xmp:all here applies to -listx and lists only the XMP tags from ExifTool's database.

Then in the same command, you are extracting all tags.

The LensType tag is not XMP, so your the -if condition will always fail.

You're making this harder than it needs to be.  Try this for the condition:

exiftool -if "$LensType eq 'NO-LENS'" ...

And try this to see all of the lens tags and where they are located:

exiftool "-lens*" -G1 -a _1040526.JPG

- 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 ($).

davidrough

Thanks Phil.

Heres' the output:

exiftool -if "$LensType eq 'NO-LENS'" /Volumes/Data/Desktop/_1040526.JPG
    1 files failed condition

exiftool "-lens*" -G1 -a /Volumes/Data/Desktop/_1040526.JPG
[Panasonic]     Lens Type                       : NO-LENS
[Panasonic]     Lens Serial Number              : 0000000

Phil Harvey

This must be failing due to hidden characters in the lens type.  (Maybe trailing spaces?)

Try this instead:

exiftool -if "$LensType =~ 'NO-LENS'" /Volumes/Data/Desktop/_1040526.JPG

The =~ will look for a sub-string.  Also, be sure you have typed a "-" symbol instead of any of the other similar-looking Unicode dashes.

- 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 ($).

davidrough

I copied the output 'NO-LENS' from the previous command and ran:

exiftool -if "$LensType =~ 'NO-LENS'" /Volumes/Data/Desktop/_1040526.JPG
    1 files failed condition



Phil Harvey

Are you running on Windows?  I assume so, or else you should see a message "LensType: Undefined variable" because your arguments are quoted for Windows.

Other than this, I am at a bit of a loss.  If you email me the image I'll try to reproduce your result.  My mail is philharvey66 at gmail.com

- 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 ($).

davidrough

Maybe this is it - I'm running on Mac (10.7.3)

How should the arguments be quoted for Mac ?

Phil Harvey

On Mac/Linux, any argument containing a $ symbol must be quoted with single quotes instead of double quotes.  So on a Mac the command would be:

exiftool -if '$LensType =~ "NO-LENS"' /Volumes/Data/Desktop/_1040526.JPG

- Phil

Edit:  Ah, yes.  This makes sense now.  I just tried running your command in a bash shell on a Mac, and bash doesn't give the "Undefined varable" message like the C-shells do.  I think that bash is the default Mac shell for recent OS X versions, but I still use a C-shell.
...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 ($).

davidrough

Ah that's better !

exiftool -if '$LensType =~ "NO-LENS"' /Volumes/Data/Desktop/_1040526.JPG  | grep -i lens
Conversion Lens                 : Off
Lens Type                       : NO-LENS
Lens Serial Number              : 0000000

Now I'll work on getting the rest of the command to do what's needed.

Many thanks for persisting with me !

davidrough

Well a lot happier than this time last night. Hopefully some one else may find this useful in updating Aperture Library shots taken with a manual lens.


exiftool -overwrite_original -P -if '$LensType eq "NO-LENS"' -LensType="Voigtländer 40mm f/1.4" -FocalLength=40 -MaxApertureValue=1.4 -FocalLengthIn35mmFormat=80  -filemodifydate=now -iptcdigest=new /Volumes/Data/Pictures/Aperture\ Library.aplibrary/Masters/2011/12/13/20111213-224513/_1040503.*

Thanks again Phil  8)

Phil Harvey

Hi David,

Great!  Glad that did it.  I should have thought of it sooner.  I must have mentioned this quotation thing hundreds of times in the past.

- 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 ($).