close
    • chevron_right

      Script to convert Canon RAW to JPEG

      Timothée Jaussoin · Saturday, 10 December, 2022 - 22:51 edit

    Just a small script that I wrote to convert directories of #RAW pictures in #JPEG. It might help some of you folks, who knows.

    This script is simplifying my flow. I am shooting everything in RAW and importing all the pictures to my Photos directory using #Gthumb. Once all the #photos are imported I pick which directory I want to keep in RAW and run this script in the other ones.

    #!/bin/bash
    
    echo "Convert $1 directory"
    exiftool -b -PreviewImage -orientation -w .jpg -ext cr2 -r "$1"
    
    echo "Copy EXIF"
    
    cd "$1"
    for file in *.CR2; do
        exiftool -tagsFromFile "$file" ${file::-4}.jpg
    done
    
    echo "Cleaning up"
    rm *_original
    

    This script is working in 2 steps.

    First it extract the internal JPEG files from the RAW files and put it next to them. As it is only data manipulation it is super fast to run.

    Then the second part is re-copying all the #EXIF information from the RAW files to the freshly extracted JPEG files (the first step doesn't take care of the EXIF manipulation).

    And finally it cleanup the RAW files.

    Oh and for the RAW development, I'm using the awesome #Darktable !