How to I batch convert .CR2 (raw) photos to JPEG? - eviltoast

Issue - I have 282 .CR2(raw) photos that need to be converted in batch/mass to same time but don’t know how. OS - Vanilla OS 22.10 (Ubuntu)

  • Can this be done with darktable? If so how?
  • Any software recommendations for this? I rather not use online tools for privacy and compression reasons.
  • zurohki@aussie.zone
    link
    fedilink
    English
    arrow-up
    19
    ·
    1 year ago

    With GNU Parallel and Imagemagick installed, this command should do it:

    parallel convert {} {.}.jpg ::: *.cr2
    

    As always, backup your files before you run things some internet rando gave you.

    • davad@lemmy.world
      link
      fedilink
      arrow-up
      3
      ·
      1 year ago

      Check out mogrify. I think it’s installed standard with ImageMagick, and it does wildcard conversions.

      • zurohki@aussie.zone
        link
        fedilink
        English
        arrow-up
        1
        ·
        1 year ago

        Can mogrify do format conversion? I thought it was for editing images. It doesn’t even seem to have a way to specify input and output filenames.

      • zurohki@aussie.zone
        link
        fedilink
        English
        arrow-up
        5
        ·
        edit-2
        1 year ago

        I’m not sure what you’re asking for. That’s the command. Unless you meant an explanation?

        The basic command is convert filename.cr2 filename.jpg.

        That parallel command runs the convert command on all of the .cr2 files in the current directory, running a bunch of them simultaneously. {} is replaced with the name of a file, and {.} is replaced with the filename without the extension.

        https://www.gnu.org/software/parallel/parallel_examples.html

        If you didn’t want to use parallel and are okay with it slowly converting one file at a time, you can just use a for loop:

        for file in *.cr2 ; do
          convert $file ${file%.cr2}.jpg
        done
        

        That one uses some Bash variable magic to remove the .cr2 and add .jpg to the file name of the output file.

        convert is smart enough that you can just give it an output name ending in .jpg and it knows it should convert the input file to JPEG.