alex7075 Posted March 21, 2010 Share #41 Posted March 21, 2010 Advertisement (gone after registration) Problem 1) solved: exiftool -overwrite_original_in_place -tagsfromfile @ '-xmp-aux:Lens<LensType' -tagsfromfile @ '-xmp-exif:ApertureValue<ApproximateFNumber' Link to post Share on other sites More sharing options...
Advertisement Posted March 21, 2010 Posted March 21, 2010 Hi alex7075, Take a look here Aperture 3.0.1 Metadata Information. I'm sure you'll find what you were looking for!
mby Posted March 24, 2010 Share #42 Posted March 24, 2010 Congrats Alex! Unfortunately, the M9 EXIF data isn't decoded that much, yet... Link to post Share on other sites More sharing options...
alex7075 Posted March 24, 2010 Share #43 Posted March 24, 2010 You know Michael, not being an applescript expert, I didn't find a proper way to include the terminal command in a script that AP3 can execute just after importing, as Fokalfissur and myself hoped. So for the moment, Adobe DNG Converter seems to me the best solution! Does Adobe DNG C. fill missing exif tags for the M9 also? Link to post Share on other sites More sharing options...
mby Posted March 25, 2010 Share #44 Posted March 25, 2010 (...)So for the moment, Adobe DNG Converter seems to me the best solution!Does Adobe DNG C. fill missing exif tags for the M9 also? Yes, it does; not sure about any other changes applied to the pic... Best, Michael Link to post Share on other sites More sharing options...
Fokalfissur Posted March 26, 2010 Share #45 Posted March 26, 2010 Made a droplet in Automator: 1. get Unix path of files (options: quotes unchecked) 2. execute shell script (options: shell =bin/bash, as argument) cat exiftool $1 -overwrite_original_in_place -tagsfromfile @ '-xmp-aux:Lens<LensType' -tagsfromfile @ '-xmp-exif:ApertureValue<ApproximateFNumber' now save it as an app. The "$1" is the path from the previous action. You need a third party action for the getting the path - you can get it here. It is easy to get the path in Apple Script, too (posixpath). This should be a good starting point for whatever. The forum should have a download area for the non-geeks. Link to post Share on other sites More sharing options...
Fokalfissur Posted March 26, 2010 Share #46 Posted March 26, 2010 You know Michael,not being an applescript expert, I didn't find a proper way to include the terminal command in a script that AP3 can execute just after importing, as Fokalfissur and myself hoped. Try not to import from aperture. Make workflow 1. type: plug in for digital images 2. run shell script 3. import to aperture. Will try it on the weekend. However, the conversion of the existing libray for uncoded lenses is another thing. Link to post Share on other sites More sharing options...
alex7075 Posted March 29, 2010 Share #47 Posted March 29, 2010 Advertisement (gone after registration) Thank you Fokalfissur, Waiting for the results of your tests ! Link to post Share on other sites More sharing options...
cbretteville Posted March 30, 2010 Share #48 Posted March 30, 2010 The g-stop is recorded in the M9 files too with a tag id of 3406h, same data type and decoding algo as with the M8 files. Carl Link to post Share on other sites More sharing options...
Fokalfissur Posted April 5, 2010 Share #49 Posted April 5, 2010 Over Eastern I found time to play with exiftool. This is the first part for setting the lensname, its focal length and max aperture. More to come. Feedback, code review and critic are welcome. I tried to comment it in detail. Just copy all the code to a new AppleScript and read the comments (they start with "--"). -- this script is to set the Name of the Lens, its focal length and its max. aperture in the exif -- Open with AppleScript Editor (ships with each Mac) and save as Application. This App serves as a droplet: just drag your dngs on it. -- exiftool must be installed. http://www.sno.phy.queensu.ca/~phil/exiftool/ -- The script just works for one Name set manually. However, it can provide a list and you just have to alter one name. -- You may add other lenses to that list and share with others. Alternatively you may send me (Fokalfissur) your lens and I'll do it for you -- on open is necessary for droplets on open these -- loop for each file repeat with this in these -- don't know why, but this is necessary: tell application "Finder" -- check if file is a dng: if name of this does not end with ".dng" then -- file is no dng display dialog "Duh! There was a least one file that isn't a .dng." end if -- First get unix path for proper use in shell: set qpath to quoted form of POSIX path of this try -- this is to set the lens for uncoded glass -- you may add your uncoded lenses with the same pattern, changing just the variable name in "set thelens to xxx" in the script afterwards -- as multiple tags are involved each lens will have a list with Lens, focal length and max Aperture -- list values {"Lensname", "Focallenght, "max. Aperture"} set cron35 to {"Leica Summicron 35mm ASPH", 35, 2} as list set voigt15 to {"Voigtländer 15mm", 15, 4.5} as list set canon50 to {"Canon 50mm 1,2", "50", "1.2"} as list set elmar65 to {"Leitz Elmar 65mm - Visoflex", "65", "3.5"} as list set elmar90 to {"Leitz Elmar 90mm - Visoflex", "90", "4"} as list set elmar65b to {"Leitz Elmar 65mm - Balgen", "65", "3.5"} as list set milar65b to {"Leitz Milar 65mm - Balgen", "65", "4.5"} as list -- link to your lens entry above here (instead the "cron35"): set mylens to cron35 as list -- a dialog to confirm your choice (just the lensname is displayed) display dialog item 1 of mylens -- 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 -- now the beef do shell script "/usr/bin/exiftool -Lens='" & lensname & "' -FocalLength=" & lenslengh & " -MaxApertureValue=" & lensap & " " & qpath on error -- something went wrong with this try block of the script: display dialog "Lens: Oh shi-" end try end tell end repeat end open Link to post Share on other sites More sharing options...
Fokalfissur Posted April 5, 2010 Share #50 Posted April 5, 2010 This script simply uses Alex' code with an AppleScript as droplet. -- on open is necessary for droplets on open these -- loop for each file repeat with this in these -- don't know why, but this is necessary: tell application "Finder" -- check if file is a dng: if name of this does not end with ".dng" then -- file is no dng display dialog "Duh! There was a least one file that isn't a .dng." end if -- First get unix path for proper use in shell: set qpath to quoted form of POSIX path of this -- now for the beef… -- note that the original is saved with .original. However, this only once. A second try will overwrite the .original with the first altered version. -- So work on copies. If you feel safe you may add the option "-overwrite_original" to the shell scripts. try do shell script "/usr/bin/exiftool " & qpath & " -tagsfromfile @ '-xmp-aux:Lens<LensType'" -- where: -- "/usr/bin/exiftool" = full path. Just "exiftool" may cause some problems in shell scripts via Apple script -- "-tagsfromfile @ '-xmp-aux:Lens<LensType'" = "-tagsfromfile" copies tags. -- left to the "<" is the destination group, right the origin. The LensType info is copied to the group xmp-aux into the field Lens on error -- something went wrong with the shell script: display dialog "Oh shi-" end try end tell end repeat end open -- to get this script work as droplet: open in AppleScript editor and save as Application Link to post Share on other sites More sharing options...
Fokalfissur Posted April 5, 2010 Share #51 Posted April 5, 2010 Just batch run the first script on my pics (set lens data). There is a bug: The choosen lens is prompted each cycle. So better delete the "display dialog item 1 of mylens" or just put "--" in front of it. I just run both scripts on app. 1000 pics and this is slow. As each manipulation reads and writes the file there is no reason not to do a script with export within Aperture. I always wanted to avoid that export-import but you run into a thousand problems if you don't do. So the next script will be from aperture, with sandy's better g-stop, too. Link to post Share on other sites More sharing options...
Delfi_r Posted April 5, 2010 Share #52 Posted April 5, 2010 Great job, and I'm waiting your Aperture script but I understand that your job it's a great advance in the right direction. Link to post Share on other sites More sharing options...
mby Posted April 21, 2010 Share #53 Posted April 21, 2010 Congrats Alex! Unfortunately, the M9 EXIF data isn't decoded that much, yet... Update: more of the M9 metadata can now be decoded by EXIFtool... Link to post Share on other sites More sharing options...
Fokalfissur Posted April 26, 2010 Share #54 Posted April 26, 2010 Great job, and I'm waiting your Aperture script but I understand that your job it's a great advance in the right direction. If you are wondering what's with my script: I didn't have the time to do much (shitstorms…) and I ran into several problems: - It seems not possible to do it just with AS (even Aperture 3 is quite limited in AS) - only way is with sqlite and poke into the Library database - I found this for Aperture 2: Database Access - database structure has changed - if I get this script running in A3 it would be wonderful: works with both managed/referenced files However. I am a complete noob regarding sql stuff and the weather is getting better from day to day… If you want to play a little bit the the database: There is a wonderful program out there (all platforms): sqlite database browser. Point it to …/Aperturelibrary/Aperture.aplib/Library.apdb Sven Link to post Share on other sites More sharing options...
5156246 Posted April 30, 2010 Share #55 Posted April 30, 2010 Thanks for all the information so far. I'd like to contribute a very small script. How to use it: 1. Change the path to the exiftool to the location where your exiftool is actually located. (Line 17). 2. Move the Skript to a convenient location, I use ~/bin since it is included in my PATH variable. "chmod +x" it, to make it executable. I guess you can do this in Finder, too. My skript is called "m9exit2xmp.sh". 3. Open Terminal, cd to the Location of your Aperture Library 4. "m9exif2xmp.sh <aperturelibrary>" The Skript now looks for every L*.DNG file in <aperturelibrary> and modifies those files as worked out in this thread. Note 1: Use at your own risk! Note 1b: Especially because it overwrites original files! Note 2: You need the latest exiftool version. You can even try this on the images that are still on the SD cards. #! /bin/bash # Skript for Leica Files, to include gAperture and Lense Name # in an "Aperture readable" way into the original DNG # @param path Path, within a recursive search will be performed [ "$1" == "" ] && { echo "No path specified." exit 1 } [ ! -e $1 ] && { echo "Path does not exist." exit 1 } PFAD=$1 EXIFTOOL=/path/to/exiftool find $PFAD -name "L*.DNG" | while read URI do echo "-> $URI" $EXIFTOOL -overwrite_original_in_place -tagsfromfile @ '-xmp-aux:Lens<LensType' -tagsfromfile @ '-xmp-exif:ApertureValue<ApproximateFNumber' $URI done Link to post Share on other sites More sharing options...
Fokalfissur Posted May 2, 2010 Share #56 Posted May 2, 2010 Seems like it works with managed and referenced imaged out of Aperture. As the exiftool stuff seems trivial now (thank to Alex) I haven't included any working code. Its just about getting the image path. If you want to ask anything - do it. (* Script -determines up your current Library -gets the path of the master image of your selection (should work on both managed and referenced) -runs exiftool How to use: Select one or more images in Aperture and then run script *) on run ----------------------------------------------------------- -- Get Aperture Libray path from Preference file and set some paths (sql, exiftool) ----------------------------------------------------------- tell application "System Events" to set p_libPath 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 p_libPath) is not 0) then set p_homePath to (do shell script "/bin/echo $HOME") set p_offset to offset of "~" in p_libPath set p_path to text (p_offset + 1) thru -1 of p_libPath set libpath to p_homePath & p_path log libpath else set libpath to p_libPath end if -- path to sql set sql to "/usr/bin/sqlite3" as string -- path to exiftool -- Set Path to sqlight database in aperture library set DBPath to (libpath & "/Database/Library.apdb") as string tell application "Aperture" ----------------------------------------------------------- -- Now loop for every image in the Aperture selection ----------------------------------------------------------- copy selection to theSel repeat with curImg in theSel --set theName to name of curImg set uuid to id of curImg -- get file path from database set SQLimagePath to quote & "select imagePath from RKMaster where UUID=(select masteruuid from RKversion where uuid='" & uuid & "')" & quote set SQLscript to sql & space & (quoted form of DBPath) & space & SQLimagePath -- first try always gets error 10004, even with tell system events ??? set imagePath to do shell script SQLscript --setting paths for managed/referenced in home directory/referenced if curImg is not referenced then set fullImagePath to libpath & "/" & imagePath & "/" else set fullImagePath to imagePath end if ----------------------------------------------------------- -- Now do shit ----------------------------------------------------------- -- example: (Note: lensname, lenslengh and lensap not defined in this script -- do shell script "/usr/bin/exiftool -Lens='" & lensname & "' -FocalLength=" & lenslengh & " -MaxApertureValue=" & lensap & " " & fullImagePath ---------------------------------------------------------------------------------- ------------------------------ Refresh metadata ! --------------------------- ---------------------------------------------------------------------------------- refresh metadata of curImg end repeat end tell end run Link to post Share on other sites More sharing options...
Fokalfissur Posted May 3, 2010 Share #57 Posted May 3, 2010 As I think my script is complete now, I have opened an new thread (just to keep problems and solution separated ) http://www.l-camera-forum.com/leica-forum/digital-post-processing-forum/124606-not-so-complete-idiots-guide-changing.html#post1318985 Link to post Share on other sites More sharing options...
mby Posted February 13, 2011 Share #58 Posted February 13, 2011 Problem 1) solved:exiftool -overwrite_original_in_place -tagsfromfile @ '-xmp-aux:Lens<LensType' -tagsfromfile @ '-xmp-exif:ApertureValue<ApproximateFNumber' P.S.: Alex, you might want to include a -P to preserve the date and time of the original file when overwriting in place. Link to post Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.