Fokalfissur Posted May 3, 2010 Share #1 Posted May 3, 2010 Advertisement (gone after registration) This is for Aperture3 and SnowLeopard (10.6) only! What the script does: - In aperture select one or more images and start the service - the service will set the lensname, max. aperture, focal lengh, update the g-stop on the master file of the selection - of cause: this is for uncoded lenses - it will overwrite the original - works on managed and referenced images Menu translation may vary (I am on a German system). This is the result of this thread: http://www.l-camera-forum.com/leica-forum/digital-post-processing-forum/117334-aperture-3-0-1-metadata-information.html 1. Make sure you have exiftools installed. If not get it here: ExifTool by Phil Harvey 2. Open AppleScript Editor and start an new script 3. copy and paste this script: on run --------------------------------------------------------------------------------- ------------ Get Aperture Libray path from Preference file -------------- --------------------------------------------------------------------------------- tell application "System Events" to set pLibPath to value of property list item "LibraryPath" of property list file ((path to preferences as Unicode text) & "com.apple.aperture.plist") -- Adjustment if in home directory if ((offset of "~" in pLibPath) is not 0) then set pHomePath to (do shell script "/bin/echo $HOME") set pOffset to offset of "~" in pLibPath set pPath to text (p_offset + 1) thru -1 of pLibPath set libpath to pHomePath & pPath else set libpath to pLibPath end if --------------------------------------------------------------------------------- ------------------- Set some paths and text delimiter -------------------- --------------------------------------------------------------------------------- -- path to sql set sql to "/usr/bin/sqlite3" as Unicode text as string -- path to exiftool set exiftool to "/usr/bin/exiftool" as Unicode text as string -- path to masters folder of managed images set managedImagesPath to (libpath & "/Masters/") as Unicode text as string -- path to database set DBPath to (libpath & "/Database/Library.apdb") as Unicode text as string -- store original and change text delimiters for later use in loop set savedDelimiters to AppleScript's text item delimiters set AppleScript's text item delimiters to {", "} ---------------------------------------------------------------------------------- ------------------------------ Lens description ------------------------------- ---------------------------------------------------------------------------------- -- ADD YOUR UNCODED LENS TO THE LIST WITH THE SAME PATTERN -- this is to set the lens for uncoded glass -- as multiple tags are involved each lens will have a list with Lens, focal length and max. aperture -- add your uncoded lenses with the same pattern -- no need to remove anything here -- Leica set cron35 to {"Leica Summicron 35mm ASPH", 35, 2} as list -- Leica Visoflex set elmar65 to {"Leitz Elmar 65mm - Visoflex", "65", "3.5"} as list set elmar90 to {"Leitz Elmar 90mm - Visoflex", "90", "4"} as list -- Voigtländer set voigt15 to {"Voigtländer 15mm", 15, 4.5} as list -- Canon set canon50 to {"Canon 50mm 1,2", "50", "1.2"} as list -- Balgen set elmar65b to {"Leitz Elmar 65mm - Balgen", "65", "3.5"} as list set milar65b to {"Leitz Milar 65mm - Balgen", "65", "4.5"} as list set elmar90b to {"Leitz Elmar 90mm - Balgen", "90", "4"} as list ---------------------------------------------------------------------------------- -------------------------- Lens list for the dialog ---------------------------- ---------------------------------------------------------------------------------- -- EXPAND THE LIST WITH ALL YOUR LENSES ABOVE WITH THE SAME PATTERN -- you may change the sorting: first lenses are on top of the dialog -- if you don't want a lens to appear simply remove the entry set LensList to {cron35 as string, elmar65 as string, elmar90 as string, elmar65b as string, milar65b as string, voigt15 as string, canon50 as string, elmar90b as string} as list ---------------------------------------------------------------------------------- --------------------------------- the dialog ----------------------------------- ---------------------------------------------------------------------------------- -- the choose dialog set mychoice to (choose from list LensList with prompt "Choose one." without multiple selections allowed) as Unicode text if mychoice is "false" then display dialog "error. check lens list dialog" end if -- the dialog is not possible with list as list elements. So the lenses were displayed as string and converted back to a list here set mylens to text items of mychoice as list -- this calls the list entries of your chosen lens set lensname to first item of mylens set lenslengh to second item of mylens set lensap to third item of mylens ---------------------------------------------------------------------------------- ---------------------------------- the loop ------------------------------------ ---------------------------------------------------------------------------------- -- This loop cycles through all the images of your selection in aperture and -- looks up where the MASTER of the image is stored and -- runs exiftool to make changes on the master tell application "Aperture" copy selection to theSelection repeat with curImgage in theSelection set uuid to id of curImgage -- get file path from database set SQLscript to quote & "select imagePath from RKMaster where UUID=(select masteruuid from RKversion where uuid='" & uuid & "')" & quote set bashquery to sql & space & (quoted form of DBPath) & space & SQLscript set imagePath to do shell script bashquery --setting paths for managed/referenced if curImgage is not referenced then set fullImagePath to managedImagesPath & imagePath else set fullImagePath to imagePath end if ---------------------------------------------------------------------------------- ---------------------------- the exiftool command -------------------------- ---------------------------------------------------------------------------------- -- this sets lensname + focal lengh + max. aperture + update the approximate aperture -- the script will overwrite the original. -- You may remove " -overwrite_original_in_place" for testing -- keep in mind that exiftool then puts an "_original" at the end of the filename -- if you run the script twice, your original is replaced by the altered file in the first run -- you may make a finder search for "_original" in Library/Masters to find all the originals (quite a few MB if you batch run the script) do shell script exiftool & " -overwrite_original_in_place -Lens='" & lensname & "' -FocalLength=" & lenslengh & " -MaxApertureValue=" & lensap & " -tagsfromfile @ '-xmp-exif:ApertureValue<ApproximateFNumber'" & space & (quoted form of fullImagePath) ---------------------------------------------------------------------------------- ------------------------------ Refresh metadata ! --------------------------- ---------------------------------------------------------------------------------- -- this is to see the results in Aperture immediately -- not sure if this applies to all versions refresh metadata of curImgage end repeat ---------------------------------------------------------------------------------- ---------------------------------- tidy up a bit -------------------------------- ---------------------------------------------------------------------------------- set AppleScript's text item delimiters to savedDelimiters end tell end run 4. Translate the code (the hammer icon) and save it 5. try to understand it. It is commented (they start with "--"). 6. If you don't understand it wait for somebody who does and confirms it is working. 7. imagine that I want to steel your images/credit card numbers/wife 8. There are two places where you have to insert your information 9. first the lens list: add your lens/focal lengh/max. aperture/ 10. then the dialog (see comments) 11. Keep in mind that every ',."{ has a meaning 12. if you are done start Automator.app 13. select "New Service" 14. on top of the work area select: Service receives "no input" in "Aperture" 15. drag "run Apple Script" into the work area 16. copy this script from the script editor 17. select everything in the "run AppleScript" window and paste the script (there must be only the script in the window) 18. translate it (push the hammer icon) 19. save it (it goes automatically into users/Library/Services 20. restart aperture 21. the service should now be available in the service menue 22. export an image as "original" and re-import 23 select it and run the service 24 the script should now have updated the exif info 25. have fun Link to post Share on other sites More sharing options...
Advertisement Posted May 3, 2010 Posted May 3, 2010 Hi Fokalfissur, Take a look here the not so complete idiot's guide to changing exif data in aperture3. I'm sure you'll find what you were looking for!
jallawalla Posted June 21, 2010 Share #2 Posted June 21, 2010 Can I be the first to say thanks! It works here. Link to post Share on other sites More sharing options...
acetrip Posted September 1, 2010 Share #3 Posted September 1, 2010 Hi I ran across your great solution for correcting EXIF data for Aperture 3 image import, by searching for a correction for wrongly identified lenses on my Sony A700. My lenses: Tamron 17-50 2.8 is identified as: Tamron AF 70-300mm f/4-5.6 Di LD MACRO 1:2 Sigma 50-200 is identified as: Minolta AF 28-80mm F3.5-5.6 (D) From my search I have found that no solution is available for this issue and many have encounterd it. I was wondering if your script could work for this case and help out many, if so, how to adjust it to work for this situation? Thank you for your great work! Cheers - /\ Ben Link to post Share on other sites More sharing options...
Fokalfissur Posted September 2, 2010 Author Share #4 Posted September 2, 2010 Hi I was wondering if your script could work for this case and help out many, if so, how to adjust it to work for this situation? Cheers - /\ Ben I think this script is not good for your purpose. The main idea is that you watch your photo in aperture, identify the lens and change it. As Aperture is recognizing your exifs systematically wrong it would be easier to make a script which runs on import. As long you don't have a Tamron 70-300 AF or Minolta 28-80 you are happy. If you are lucky the aperture detected correctly. You may also batch run this script directly on the masters in Library. No need to work with the aperture database. All you need is exiftool. Hope this helps, Sven Link to post Share on other sites More sharing options...
acetrip Posted September 2, 2010 Share #5 Posted September 2, 2010 Hi Sven Thank you for your quick response, I do not have the wrongly identified lenses, and I think that the aperture is detected correctly. I have installed EXIF tool, though unfortunately I do not know anything about using scripts, Can you advice on how to automatically correct the lens info on Aperture 3 import as you suggested? BTW: What are the implications of working in Aperture 3 with wrongly identified lenses? Thank you - /\ Ben Link to post Share on other sites More sharing options...
Fokalfissur Posted September 3, 2010 Author Share #6 Posted September 3, 2010 Hi Sven Thank you for your quick response, I do not have the wrongly identified lenses, and I think that the aperture is detected correctly. I have installed EXIF tool, though unfortunately I do not know anything about using scripts, Can you advice on how to automatically correct the lens info on Aperture 3 import as you suggested? BTW: What are the implications of working in Aperture 3 with wrongly identified lenses? Thank you - /\ Ben implications: inconvenient if you sort/search by lens/focal length etc. script: exiftool is a "terminal app". it can be controled via the terminal or "termnial scrips" which are called shell scripts (very powerful). These shell scrips can be called by apple script. This is what the above apple script does. advise: first get the right exiftool command. This is tricky. Look for a sony forum for help as here you won't find anybody with the same camera and problem here. If you got the right command you can try to automate it. As far as I know there is an option to run a script if you import via image capture. But it shouldn't be too annoying to batch run a script on the images before importing to Aperture. Keep in mind that exiftool rewrites the complete images instead of just altering the exif infos. cheers, Sven Link to post Share on other sites More sharing options...
carstenw Posted September 26, 2010 Share #7 Posted September 26, 2010 Advertisement (gone after registration) Let me add my belated thanks for this useful script! I found a couple of minor problems: - pOffset is referred to later as p_offset - lengh is spelled length - if using this with Nikon systems, and the minimum aperture is changed, you may end up with the wrong aperture value. For example, if a lens is manually coded in a Nikon with a minimum aperture of f/2.5, and you forget to change this manual lens setting when using a lens of minimum aperture 2.8, you will see an aperture value of 2.5. It should be possible to fix this, but for now I am too lazy and just leave it. I might revisit this later and try to figure out how to do a proper correction, or I might also just bump up the minimum aperture to the new proper minimum aperture. Mal sehen. Link to post Share on other sites More sharing options...
coup de foudre Posted September 26, 2010 Share #8 Posted September 26, 2010 just as an FYI, an excellent Aperture site is here: ApertureExpert.com — Your resource for tips & tricks, eBooks and education on Apple's Aperture 3 - Tips & Tricks he knows Aperture inside out and can probably smooth out any rough edges. he's an excellent photographer in his own right, his only failing is that he doesn't use a Leica Link to post Share on other sites More sharing options...
Fokalfissur Posted September 27, 2010 Author Share #9 Posted September 27, 2010 Let me add my belated thanks for this useful script! I found a couple of minor problems: - pOffset is referred to later as p_offset - lengh is spelled length - if using this with Nikon systems, and the minimum aperture is changed, you may end up with the wrong aperture value. For example, if a lens is manually coded in a Nikon with a minimum aperture of f/2.5, and you forget to change this manual lens setting when using a lens of minimum aperture 2.8, you will see an aperture value of 2.5. It should be possible to fix this, but for now I am too lazy and just leave it. I might revisit this later and try to figure out how to do a proper correction, or I might also just bump up the minimum aperture to the new proper minimum aperture. Mal sehen. 1. Looks as if your right. This part looks up the path of your Aperture Library. If it is in your Homefolder (mine isn't) and it breaks replace "p_offset" with "pOffset". Have no time for testing though. 2. "lengh" is spelled "lengh". However, if you are looking for "length" as "width" you should buy a "t". To change it you must change all (best with find and replace all). 3. I don't understand… 4. There are some wrong quotes in the "Lens description" section. Still the script works fine. I guess with quotes the number is handled in the script as a string and not a number. The results seem to be the same. Cheers, Sven Link to post Share on other sites More sharing options...
carstenw Posted September 27, 2010 Share #10 Posted September 27, 2010 1.Looks as if your right. This part looks up the path of your Aperture Library. If it is in your Homefolder (mine isn't) and it breaks replace "p_offset" with "pOffset". Have no time for testing though. 2. "lengh" is spelled "lengh". However, if you are looking for "length" as "width" you should buy a "t". To change it you must change all (best with find and replace all). 3. I don't understand… 4. There are some wrong quotes in the "Lens description" section. Still the script works fine. I guess with quotes the number is handled in the script as a string and not a number. The results seem to be the same. Cheers, Sven I should have been clearer: I fixed the above issues, plus the quotes, and it worked great. Thanks a million! I just wanted to point the changes out to any future readers, to save them time. About 3., I have a Nikon D3 and both AI-S 105mm f/2.5 and Carl Zeiss 21mm f/2.8 Distagon ZF, neither of which is coded. It is necessary to set the camera for the correct lens to get the correct EXIF. Of course, I forgot a bunch of times. The script changes the lens and focal length, as well as the max. aperture, but the shots taken with the Distagon wide open at f/2.8, but falsely labelled as the 105mm f/2.5, are labelled as being shot at f/2.5. Something about how the Nikon reads apertures from a lens. The script didn't fix those, so now with my fixed 21mm EXIF, the aperture sometimes says f/2.5 Not a big deal, but I will fix it one day. I just need to stop being lazy and figure out 1) how the Nikon handles aperture recording, and 2) how to adjust the apertures with AppleScript. Link to post Share on other sites More sharing options...
Fokalfissur Posted September 28, 2010 Author Share #11 Posted September 28, 2010 I should have been clearer: I fixed the above issues, plus the quotes, and it worked great. Thanks a million! I just wanted to point the changes out to any future readers, to save them time. That was the reason I started a new thread. About 3., I have a Nikon D3 and both AI-S 105mm f/2.5 and Carl Zeiss 21mm f/2.8 Distagon ZF, neither of which is coded. It is necessary to set the camera for the correct lens to get the correct EXIF. Of course, I forgot a bunch of times. The script changes the lens and focal length, as well as the max. aperture, but the shots taken with the Distagon wide open at f/2.8, but falsely labelled as the 105mm f/2.5, are labelled as being shot at f/2.5. Something about how the Nikon reads apertures from a lens. The script didn't fix those, so now with my fixed 21mm EXIF, the aperture sometimes says f/2.5 Not a big deal, but I will fix it one day. I just need to stop being lazy and figure out 1) how the Nikon handles aperture recording, and 2) how to adjust the apertures with AppleScript. Now I understand. The script just takes the selection in aperture, looks for the master, finds the correct path in the library and then points an exif scipt to that file. So it has nothing to do with the apple script - it relates to the exif shell script. Leica chose a weird way to save the estimated f-stop. Nikon may have another way. I suggest that you ask in a nikon forum for a solution with exiftool as I cannot help you with Nikon stuff. Once you have the exif command it should be easy to insert it into the script. Cheers, Sven Link to post Share on other sites More sharing options...
pimver Posted December 2, 2010 Share #12 Posted December 2, 2010 Sven, (or anyone else), I am a new M9 with summilux's users, will this work for getting my additional information, lens , f-stop into the Aperture exif/metadata. I have been an Aperture user from day-1 and it is utterly frustrating that the exif data from my M( do not show up as complete as I would have wished thanks Link to post Share on other sites More sharing options...
Fokalfissur Posted December 5, 2010 Author Share #13 Posted December 5, 2010 Pimver, the script is a wrap around for exiftool shellscrips for convenience with apperture3. My contribution was just to find the master images in the aperture library (by sql search) and a routine for applying lens information on non-coded lenses via a selection in aperture. I have borrowed the shellscript from others. As I don't have an M9 I won't work on a solution. Try to find the proper exiftool script and apply it to the applescript. Good luck, Sven Link to post Share on other sites More sharing options...
pimver Posted December 5, 2010 Share #14 Posted December 5, 2010 HI Sven, the question was more around whether the scrip tis for uncoded lenses only or if I could use it with the latest 'lux 35 mm thanks Pim Link to post Share on other sites More sharing options...
Fokalfissur Posted December 5, 2010 Author Share #15 Posted December 5, 2010 If you just want the metadata be displayed for coded lenses in apperture I suggest a batch script on import (and previously on all your images in your library). Look for m9 + exiftool Again, the purpose of this script is to identify the lens of an uncoded/tagged image in aperture by looking at it, select it (or multiple pics of the same lens), fire up the apple script from the menu, choose your lens and voilá. The problems I solved are apperture3 related; the exiftool script is taken from much more savvy guys. You might dig in the original thread linked in my initial post. Sven Link to post Share on other sites More sharing options...
pimver Posted December 28, 2010 Share #16 Posted December 28, 2010 Thanks, i did all the digging and forum searching one can imagine, but i think we are losing each other, Only thing I want is the dng's from my brand new m9 and summiluxes to have the f-stop and lens info in the exif in aperture. Unless I am missing anything big, all exif-tool, apple scripting etc have not allowed me to achieve this. As we speak the stop gap solution I am using on my macbook pro after shooting is to import the dng into light room without adding them to the catalog, After getting home inexport them to amfolder on my iMac and subsequently import in aperture, this will give me the desired exif/lens info Link to post Share on other sites More sharing options...
mby Posted February 5, 2011 Share #17 Posted February 5, 2011 Thanks, i did all the digging and forum searching one can imagine, but i think we are losing each other,Only thing I want is the dng's from my brand new m9 and summiluxes to have the f-stop and lens info in the exif in aperture. Unless I am missing anything big, all exif-tool, apple scripting etc have not allowed me to achieve this. As we speak the stop gap solution I am using on my macbook pro after shooting is to import the dng into light room without adding them to the catalog, After getting home inexport them to amfolder on my iMac and subsequently import in aperture, this will give me the desired exif/lens info Hi, This should help for f-stop: http://www.l-camera-forum.com/leica-forum/digital-post-processing-forum/117334-aperture-3-0-1-metadata-information-3.html#post1273298 and this for lens type http://www.l-camera-forum.com/leica-forum/digital-post-processing-forum/117334-aperture-3-0-1-metadata-information-2.html#post1272090 Fields out of EXIFtool v8.48 are for example ---- Leica ---- LensType: Elmar-M 50mm f/2.8 ApproximateFNumber: 3.0 MeasuredLV: 2.33 ExternalSensorBrightnessValue: -1.03 ---- Composite ---- LensID: Elmar-M 50mm f/2.8 Best, Michael P.S.: M9 Maker Notes are supported in EXIFtool since about v8.18... Link to post Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.