Skip to main content

Batch photo editing, The Linux way

I'm really in love with those tiny tools that can do the magic to you when you are really depressed looking for a miracle to get your task done.
I work as action photographer in my free time and yesterday I had to edit 200 shot in a very short time, first I downloaded the RAWs into my computer and then started to delete the ruined ones and then I needed a way to convert all of my CR2 files into JPG; after bit of googling I found that there is a living application out there called DCRAW that let you decode all of your RAW files and then you can pass your decoded data into a tiny application called CJPEG that can compress the image file into JPEG image file and so I did
for i in *.CR2; do dcraw -c -a -w -v $i | cjpeg -quality 100 > $i.jpg; done;
This is the magic of command line tools in GNU/Linux, I was able to get all of my RAWs decoded and converted into JPEG in about two hours which includes googling for for the way to batch edit photos and convert RAWs to JPEG.
If you are into Photography then you would understand how many hours I have saved to get this task done.
Later I wanted to add a border and my signature to all of these photos plus I needed to resize them for web usage so I used Phatch.
Phatch is a simple to use cross-platform graphical Photo Batch Processor and Exif Renamer with a nice graphical user interface. Phatch handles all popular image formats and can duplicate (sub)folder hierarchies. Phatch can batch resize, rotate, apply shadows, perspective, rounded corners, … and do much more actions in minutes instead of hours or days if you do it manually.

I can certainly confirm that phatchs saved lots of my time, in return I'll start translating it into Arabic language out of respect and to give something back to the developers and the community.
Photo editing under Linux isn't that user friendly yet, but I'm pretty sure it will definitely be user friendly when Phatch get stabilised and gets more features.
NOTE: This example was tested with dcraw v8.80 and cjpeg 6b. cjpeg is available under libjpeg-progs package.
[tags] action photographer, arabic language, batch processor, command line tools, cross platform, dcraw c, decoded data, folder hierarchies, gnu linux, googling, graphical user interface, image file, image formats, raw files, raws, renamer, rounded corners, tiny application, tiny tools, web usage, dcraw c, folder hierarchies, graphical user interface, action photographer, command line tools, decoded data, batch processor, tiny application, tiny tools, raws, gnu linux, raw files, community photo, web usage, rounded corners, googling, image formats, renamer, stabilised, arabic language [/tags]


  1. Thanks! I came across your post while searching for this exact technique. You just saved me hours. I set it to batch convert 130 CR2s and it worked perfectly. Cheers!

  2. Les Ritchin
    If it was seriously useful and saved your time you might consider donating.

  3. Peter PavlovichMay 6, 2008 at 3:34 AM

    In your example, you use the option " -B 2 4 ". In the latest version of dcraw, the "-B" option is not supported. At least, the version of dcraw that is installed in Ubuntu doesn't support it. I looked on the dcraw website and could find no mention of this command line parameter -- but perhaps I was not looking in the right place.
    Could you tell me what the " -B " option was (or is) for and what you used it for? Perhaps there is an alternate option available which will accomplish the same thing? The version that I have installed is v8.80.
    Thanks in advance!

  4. Peter
    Thank you for the note, I have just updated the code with the current working version which is the same of yours and now I'm not sure if -B was a mistake or was an option in the previous version.
    Thank you again
    p.s: I had to remove the dcraw help from your comment as it was really long for the comment space.

  5. [...] Shared Batch photo editing, The Linux way. [...]

  6. Thanks so much for that. I have tried a number of similar scripts and it just didn't get it to work until I found your post.

  7. Batch image converter and photo editor:


Post a Comment

Popular posts from this blog

اهم التطورات العلمية في العام ٢٠١٩

Dear Microsoft : It's over. Our relationship just hasn't been working for a while, and now, this is it. I'm leaving you for another Operating system. I know this isn't a good time--you're down with yet another virus. I do hope you feel better soon--really, I do--but I, too, have to move on with my life. Fact is, in the entire time I've known you, you seem to always have a virus or an occasional worm. You should really see a doctor. That said, I just can't continue with this relationship any longer. I know you say you'll fix things, that next time it'll go better--but that's what you said the last time--and the time before that. Each time I believed you. Well, not any longer. You cheater! The truth is there's nothing more you can say to make things better. I know about your secret marriage to patent. You say you two are not seeing each other anymore, but I just don't believe it. You say you can live without patent, and I've heard that

10 things Dorothée Loorbach learned after losing a lot of money

Dorothée isn't just sharing her life changing experience with work and money, and sharing the following tips which won't make much sense without listening to the tips in her own words Money is important Money equals time Money equals value What people say doesn't matter What people say matters most when people is you! It's really simple - spend less, earn more, invest wisely and value yourself. It's not that easy Being broke sucks Stay Broke - be present in your own life Money isn't important