Monday, December 5, 2011

Batch Convert Multipage CR2 to JPG

I landed up with a bunch of CR2 files (Canon Digital Raw Images from camera), which I needed to convert to JPG. On Ubuntu, I was able to view the CR2 format file using the installed Image Viewer and Gimp, after installing ufraw package.

However, the "convert" tool of ImageMagick was not able to convert to jpeg in a proper way - see the attached example converted images. This was due to the fact that the CR2 image has multiple pages and the "convert" tool is unable to understand this properly. (CR2 images with single page was successfully converted to jpg).

Gimp was able to open the CR2 file, but I had to specifically mention "Page1" in the "Import from Tiff"  dialog box. However, since I have to convert several CR2 files, manually opening them and converting was not an option. And I was also unable to figure out how to specify "Page1" in the gimp scripts (.scm files) or the Python-fu (pdb.file_load_tiff) scripts.

Finally, I was able to use the "convert" tool itself to convert to JPEG, but simply renaming the CR2 file as a TIFF file and using the same convert command like
convert renamed_cr2.tiff image.jpg
And that's it! It showed some errors about reading Tiff file (as it is not really a TIFF file) - but was able to successfully convert it.

No comments:

Post a Comment