Saturday, May 4, 2024
13
rated 0 times [  13] [ 0]  / answers: 1 / hits: 6549  / 2 Years ago, sun, november 13, 2022, 4:00:37

I want to convert all NEF/RAW image files to an image format that could be easily opened without additional tools.


I thought about using ImageMagick's convert tool as mentioned in How can I convert a .jpg or .png image to .raw format?


However, I don't see any parameter for recursively looking for images in all subfolders nor for removal of old/original images in the documentation of the convert tool.


Should I look for another tool, or the only option is to write some loop around convert?


More From » command-line

 Answers
6

Imagemagick cannot convert raw image files in recent Ubuntu versions because the ufraw-batch package is not available, due to it not being maintained anymore. We can however use darktable to do the conversion. To install darktable run:


sudo apt install darktable

You can then use this command that uses darktable-cli to convert the images:


find . -type f ( -iname "*.raw" -o -iname "*.nef" ) -exec sh -c 'darktable-cli {} ${0%.*}.jpg' {} ; -delete

The above command uses find to do the following:



  • recursively search in the current folder: .

  • for files only: -type f

  • that their name ends either in .raw or .nef, irrespective of their case: ( -iname "*.raw" -o -iname "*.nef" )

  • executes (-exec) this command to convert the found files to jpg: sh -c 'darktable-cli {} ${0%.*}.jpg' {} ;

  • deletes the original files: -delete


Caution: Make sure to first test the command in a copied portion of your files to ensure that it works as intended!


[#1579] Tuesday, November 15, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hical

Total Points: 498
Total Questions: 106
Total Answers: 117

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
hical questions
Sun, May 9, 21, 00:59, 3 Years ago
Fri, Jun 25, 21, 03:06, 3 Years ago
Thu, May 19, 22, 15:32, 2 Years ago
Thu, Aug 4, 22, 16:57, 2 Years ago
;