I need to convert a lot of CR2 photos to either JPG or PNG, no editing. How to do this?



you can convert .cr2 to .jpeg by ufraw.

sudo apt-get install ufraw

Right click on the file and select open with ufraw.

** You can also import them to Gimp with gimp-ufraw and then export as .png or .jpeg.

sudo apt-get install gimp-ufraw
  • Didn't work for my photos shot on Canon 700D. Unable to open file of type CR2. – Greg Aug 11 at 20:54

I'll go a different route... Use ufraw-batch not ufraw.

sudo apt-get install ufraw-batch

## This will output (not replace) the file with a new extension.
## foo.CR2 exported to foo.png
ufraw-batch --out-type png *.CR2

See ufraw-batch --help and man ufraw-batch for more info.

  • 1
    ufraw-batch is awesome! – jemiloii Sep 13 '16 at 20:00
  • ufraw-batch --out-type png $(ls IMG_93{44..99}* 2>| cat) – smac89 Feb 19 '18 at 0:07
  • 5
    In some cases, ufraw-batch leads to a segmentation fault. It will successfully develop one RAW file, and then it stops. See bugs.launchpad.net/ubuntu/+source/ufraw/+bug/1768855 for further information. – user258532 Sep 14 '18 at 12:13

For another alternative, use mogrify:

mogrify -format png *.cr2
  • 2
    it should be stated that mogrify is part of imagemagick, which is available at imagemagick.org. however, mogrify uses ufraw-batch in the background, so might as well use that directly – dominik andreas Apr 22 '18 at 9:29
  • 2
    +1 as mogrify circumvents the bug in ufraw-batch that leads to a segmentation fault (asper Sptember 2018) – Bruni Sep 23 '18 at 12:30
  • This worked nicely. I just wish there was a verbose option because I didn't realize it was succeeding on a long-running job. – Sridhar Sarnobat Nov 29 at 2:06

Try nconvert

As command line tool OR xnconvert as GUI tool

  • 6
    Please explain how to use xnconvert. – NGRhodes Jun 14 '14 at 22:10
  • This is now a Famous Question. We do not like these sort of answers. This should be deleted. – fosslinux Aug 2 '16 at 3:15
  • ./nconvert -out jpeg -truecolors /path/to/images/folder/*.CR2 – Sagar Nikam Jan 15 at 10:47
  • 1
    It's not a helpful answer, but the xnconvert tool worked better for me than all of the other options. You have to download and install the .deb file (no PPA as far as I can tell) but the conversion process was fast and accurate, better colour reproduction than either ufraw or dcraw and faster than either batch process. Using it is reasonably easy, point it at a directory of CR2 files and tell it where to drop the JPEGs and click the button. – delatbabel Aug 26 at 6:27

You could also program a simple loop in the console.

For example (using the fish console), and assuming the active directory only has RAW files.

set files (ls)
for i in $files
    dcraw $i


set files (ls)
for i in $files
    ufraw-batch --out-type=tif --out-depth $i

I use ufraw-batch that way because it often leads to an error, see https://bugs.launchpad.net/ubuntu/+source/ufraw/+bug/1768855 .


The method that really worked for me:

You need dcraw and ppmtojpeg (install with apt)

for i in *.CR2; do dcraw -c $i | ppmtojpeg > $1.jpg; echo $i done; done

What it does: First convert CR2 to PPM with dcraw passing the output to ppmtojpeg which converts to JPG.

I found this here



exiftool -Composite:PreviewImage -b photo.CR2 > photo.jpg

Longer answer:

ufraw-batch conversion quality is very bad. Imagemagick uses ufraw under the hoods (unfortunately). dcraw is better, but still not great. The best solution I found out was to use exif to extract PreviewImage metadata. I believe that's generated by the camera itself.

Ref: https://www.imagemagick.org/discourse-server/viewtopic.php?f=3&t=6936&sid=9548c421f1bd69f192e632d06ca03dff&start=30#p130949


Create a bash file like foo.sh and execute as ./foo.sh in command line:


for i in $(ls)
ufraw-batch --out-type png $i
echo "conversion done $i"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.