AppleScript For Adding Camera Temp To CR2 File Name
I thought I'd share a little Mac utility script I just wrote for adding the Canon internal temperature information to the filename for CR2 files.
Certain models of Canon cameras store the temperature in the EXIF data. I'm tapping into that to put it in the filename where it's more easily accessible for dark frame matching.
: Please don't ask me which models, I don't know. I have a 1000D. You can run a simple test to see if your camera has the temp info in the EXIF by:
1) Open your CR2 file in Preview
2) Under the Tools menu choose "Show Inspector"
3) Under the Canon tab see if CameraTemperature is listed.
If it is, then you can use this script. If it's not, then you can't. So far as I know, most, if not all of the newer models have it.
Here is some info on the script:
- OS: Unknown - I wrote it in 10.6.5
- Pre-Req: ExifTool (a command line EXIF extraction utility)
- Camera: Must be a model that stores this information in the EXIF dataFilename: Must have "dXX" in the file name or you need to edit the script
- Double click the script to launch it
- Point it to a folder containing CR2 files (it will find the CR2s if there are other files in there)
- Follow the dialog to abort, rename with confirmation for each file or rename all files blindly
Some info on the file name
- I use as my file naming convention: Object-ISO-Duration-TempInDegrees-SequenceNumber.CR2
- An example file name looks like this: M42-i800-s300-d35-001.CR2
- To use this script as is, the filename must have dXX somewhere in it.
- Examples: M42-i800-s300-dXX-001.CR2, or ABC-123_dXX.53888.CR2
- As is, the dXX will be replaced with the temperature rounded to the nearest whole number
- As is, the script will convert the temp from C to F (easily modified if you don't want that)
Tips for changing the script
Open the script in the Apple Script Editor to make changes to it (or to just look at it)
- The script logic should be pretty self explanatory if you don't like my naming convention or if you want it to do something else. Applescript is very easy to write.
- There is some info in the script itself to help guide where someone may want to change it. It's less then 100 lines and only a handful do the things most folks would want to change.
- There are some default parameters at the beginning of the script to do some basic customization:
- Convert to Fahrenheit (default is true)
- String To Replace (default is "dXX")
- Whether to do a replace or just append the temperature to the end (default is to perform a replace)
- A leading and trailing character or string
You can ask me some questions about it if you want, but I'm not an AppleScript expert.
This script is NOT supported or guaranteed. It's free and I don't want donations or anything. USE AT YOUR OWN RISK.
Download the script here:
Download ExifTool here:
Someone may want to do something similar for Windows users.