ufraw-batch to convert Canon camera’s raw images to jpg file

(03/09/2013; 10/06/2012;)
–wb=camera option works fine.

‘–exposure=auto’ option produces undesired effect on most raw images. Use it after checking the image on ufraw.

My Canon camera saves raw images as .CR2 files.

ls -lh *.CR2
-rw-r--r-- 1 penguin penguin 7.3M Sep 19 20:07 IMG_0006.CR2
-rw-r--r-- 1 penguin penguin 8.7M Sep 19 20:08 IMG_0007.CR2
-rw-r--r-- 1 penguin penguin 9.0M Sep 19 20:09 IMG_0008.CR2
-rw-r--r-- 1 penguin penguin 11M Sep 19 20:10 IMG_0009.CR2
-rw-r--r-- 1 penguin penguin 11M Sep 19 20:10 IMG_0010.CR2
-rw-r--r-- 1 penguin penguin 11M Sep 19 20:10 IMG_0011.CR2
-rw-r--r-- 1 penguin penguin 11M Sep 19 20:11 IMG_0012.CR2
-rw-r--r-- 1 penguin penguin 11M Sep 19 20:11 IMG_0013.CR2
-rw-r--r-- 1 penguin penguin 11M Sep 19 20:11 IMG_0014.CR2

I modified the ufraw-batch script here. I named the script as raw2jpg.

# http://jcornuz.wordpress.com/2007/10/10/workflow-3-quick-raw-converting-batch/

# processes raw files
for f in *.CR2;
        echo "Processing $f"
        ufraw-batch \
                --wb=camera \
                --out-type=jpeg \
                --compression=96 \
                --out-path=. \

# change the image names
for i in *.jpg;
        mv "$i" "${i/.jpg}"_r.JPG;

Run result:

$ time raw2jpg
Processing IMG_0006.CR2
ufraw-batch: Loaded IMG_0006.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0006.jpg
Processing IMG_0007.CR2
ufraw-batch: Loaded IMG_0007.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0007.jpg
Processing IMG_0008.CR2
ufraw-batch: Loaded IMG_0008.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0008.jpg
Processing IMG_0009.CR2
ufraw-batch: Loaded IMG_0009.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0009.jpg
Processing IMG_0010.CR2
ufraw-batch: Loaded IMG_0010.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0010.jpg
Processing IMG_0011.CR2
ufraw-batch: Loaded IMG_0011.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0011.jpg
Processing IMG_0012.CR2
ufraw-batch: Loaded IMG_0012.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0012.jpg
Processing IMG_0013.CR2
ufraw-batch: Loaded IMG_0013.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0013.jpg
Processing IMG_0014.CR2
ufraw-batch: Loaded IMG_0014.CR2
ufraw-batch: Saved /home/penguin/Pictures/920/IMG_0014.jpg

real 0m32.841s
user 1m14.768s
sys 0m0.620s

About janpenguin

Email: janpenguin [at] riseup [dot] net Every content on the blog is made by Free and Open Source Software in GNU/Linux.
This entry was posted in Photography and tagged , , , , , , . Bookmark the permalink.

2 Responses to ufraw-batch to convert Canon camera’s raw images to jpg file

  1. Joost Timmerman says:

    I don’t know if this changed since this post was made, but a for loop does not seem necessary to me. Since this post was high in my google results, i figured this might be useful for more people.

    Just calling ufraw-batch on multiple files creates JPG’s for each CR2 (or whatever supported raw format).

    $ cd /home/joost/importantpictures
    $ ufraw-batch --wb=camera ---out-type=jpeg --compression=90 *
    ufraw-batch: Loaded IMG_1228.CR2 [1/4]
    ufraw-batch: Saved /home/joost/importantpictures/IMG_1228.jpg [1/4]
    ufraw-batch: Loaded IMG_1229.CR2 [2/4]
    ufraw-batch: Saved /home/joost/importantpictures/IMG_1229.jpg [2/4]
    ufraw-batch: Loaded IMG_1230.CR2 [3/4]
    ufraw-batch: Saved /home/joost/importantpictures/IMG_1230.jpg [3/4]
    ufraw-batch: Loaded IMG_1231.CR2 [4/4]
    ufraw-batch: Saved /home/joost/importantpictures/IMG_1231.jpg [4/4]

  2. Patrick says:

    This is perfect. 1 liner to convert thousands of CRW to JPG which I needed to do a slideshow on my PS3 which doesn’t support CRW. Thank you. Simpler and faster than a aconv script.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s