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. 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

?????? ?????

?????, ?????, ????? ??? ???? ?????! ?? ????? ??????? ???, ??? ?? ???? ?? ?????? ??? ???? ?? ???? ??? ???? ?? ??? ???? ???? , ???? ???? ????? ???????, ????????, ???? ???????, ???? ? ???? ? ???? ????? ???? ????? ??????, ?????? ???? ?? ????? ?????? ???? ????? ??? ??????? ?? ????? ? ??? ?? ??????? ???????? ?? ???? ?? ????? ???? ????? ??? ?????? ? ???? ?????? ????? ? ???? ????? ?????? ???? ?????? ???? ???? ????? ? ???????? ???? ???????, ??? ?????? ????? ?? ??? ????? ?????? ??? ??????? ??? ??? ??????? ????? ???? ? ???? ????? ??? ???? ??? ???? ???? ??????, ?? ????? ??? ?????? ???????? ??? ?????? ?? ??? ???? ???? ?? ??, ???? ???? ??? ?? ????? ?????? ??????

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

القضاء: لا دليل على أن مقتحمي الكونغرس خططوا لقتل مشرعين

أكد محققو وزارة العدل الأمريكية أنهم لم يجدوا حتى الآن أي دليل على أن أنصار دونالد ترامب الذين هاجموا مبنى الكونغرس الأسبوع الماضي خططوا لاحتجاز مسؤولين منتخبين وقتلهم. يأتي ذلك في الوقت الذي أُوقفت فيه الشرطة، الجمعة، رجلا مسلّحا في واشنطن خلال محاولته عبور إحدى نقاط التفتيش في محيط مبنى الكونغرس حيث ستقام الأربعاء مراسم تنصيب جو بايدن. في ذات الوقت أفادت شبكة NBC الأمريكية، بأن مكتب التحقيقات الفيدرالي يحقق في إمكانية تمويل حكومات أو جماعات اقتحام مبنى الكونغرس. وقالت مصادر للشبكة: "المكتب يحقق في مدفوعات "بيتكوين" بقيمة 500 ألف دولار، يبدو أنه تم تحويلها من قبل مواطن فرنسي، لشخصيات ومجموعات رئيسية يمينية قبل اندلاع أعمال الشغب". وفي جلسة استماع في محكمة أريزونا بشأن اعتقال أحد مثيري الشغب جاكوب تشانسلي الذي يؤمن بنظرية المؤامرة ومن أتباع الحركة اليمينية المتطرفة "كيو-آنون"، تراجع المدعون الفيدراليون عن اتهامات سابقة بأن أنصار ترامب كانوا يخططون "لاحتجاز مسؤولين منتخبين وقتلهم" في هجوم السادس من كانون الثاني/ يناير في واشنطن. ع