Patch exif data for Sigma Lens

Non Canon lenses can be great or even better than the one provided by Canon itself (i.e the Sigma 50mm f/1.4 DG HSM Art). The only problem you have is that theses lenses are not natively recognized by your camera body. In Adobe Lightroom instead of getting a nice description of the lens used to shot the given picture as you can see below

EF50mm1_2

you get a super generic info like 50mm as you can see below

DG50mm1_4

This is of course not nice at all and we should be able to do better than that.

Ideally you should be able to tell Lightroom to overwrite meta-data during import and replace them by some new ones. Lightroom is however unable to do that. It’s equally unable to run any king of user defined script after import. The solution comes from Automator. I have experienced with folder actions and it was no good. Action may take far to long to be triggered (sometimes more that two minutes after folder modification) and, worse than all, modifications are lost after reboot. So I decided to go for a automator service workflow.

This workflow use a command line tool called ExifTool and can be called either on a folder or on a file. It logs in selected folder or at the same place as the processed files. It only modify the tags of corresponding files (so no need to remember which picture was taken with which lens). I recommand you not to modify directly the file on the SD card because if something goes wrong your original are gone. Instead I personally first copy the picture to a staging folder, call the service and finally import into Lightroom. In theory you could import and then call the service, but this will be awfully slow because all of the files in the same folder would be checked against the filter “Sigma”. On top of that you would also have to re-synchronize you Lightroom library as the Exif data are only read during import.

All that being said here’s the Automator workflow:

wf_screenshot

and the bash shell script code:

1
2
3
4
5
6
7
8
9
10
11
12
if [[ -d $1 ]]; then
	LOG_FILE="$1/tag_sigma.log"
else
	LOG_FILE="$(dirname $1)/tag_sigma.log"
fi
echo "start processing at: $(date)" >> $LOG_FILE
for f in "$@"
do
	exiftool -overwrite_original -P -q -lensmodel="DG50mm f/1.4 HSM | A" -lensserialnumber="XXXXXXXX" -if '$lensid eq "Sigma 50mm f/1.4 DG HSM | A"' -v0 "$f" >> $LOG_FILE
done
echo "======== file(s) were processed" >> $LOG_FILE
echo "end processing at: $(date)" >> $LOG_FILE

As you can see the script also tags the lens serial number (see “XXXXXXXX”) which is otherwise reported as “00000000” and is specifically looking for the DG 50mm 1.4 HSM Art lens. It can however easily be modified to match your own lens(es).

Script: tag_sigma_exp.workflow