Using ImageMagick
ImageMagick is a popular tool for image processing in Linux. It can convert images to and from a wide array of file formats, including CR2. To install ImageMagick, run the following command:
sudo apt install imagemagick
To convert a single CR2 file to JPG or PNG, use the convert command with the following syntax:
convert input.cr2 output.jpg
convert input.cr2 output.png
To convert multiple CR2 files at once, you can use a for loop:
for file in *.cr2; do convert "$file" "$ (basename $file .cr2).jpg"; done
for file in *.cr2; do convert "$file" "$ (basename $file .cr2).png"; done
You can also specify some options to adjust the quality or size of the output images. For example, to reduce the quality of JPG images to 80%, use the -quality option:
convert input.cr2 -quality 80 output.jpg
To resize the output images to a maximum width or height of 800 pixels, use the -resize option:
convert input.cr2 -resize 800x800 output.jpg
You can combine multiple options as well. For more information, see the ImageMagick documentation.
Using ufraw
ufraw is another tool that can convert raw images to other formats. It also has a graphical user interface called ufraw-gimp, which allows you to edit the raw images before converting them. To install ufraw and ufraw-gimp, run the following command:
sudo apt install ufraw ufraw-gimp
To convert a single CR2 file to JPG or PNG using ufraw, use the ufraw-batch command with the following syntax:
ufraw-batch --out-type jpg input.cr2
ufraw-batch --out-type png input.cr2
To convert multiple CR2 files at once, you can use a wildcard:
ufraw-batch --out-type jpg *.cr2
ufraw-batch --out-type png *.cr2
You can also specify some options to adjust the output images. For example, to set the white balance to auto, use the --wb option:
ufraw-batch --out-type jpg --wb auto input.cr2
To rotate the output images by 90 degrees clockwise, use the --rotate option:
ufraw-batch --out-type jpg --rotate 90 input.cr2
You can combine multiple options as well. For more information, see the ufraw-batch man page.
Using dcraw
dcraw is a simple and fast tool that can decode raw images and convert them to other formats. It supports many raw formats, including CR2. To install dcraw, run the following command:
sudo
c8f7815bcf