2
\$\begingroup\$

I'm working on a set of photos that I want to enhance automatically. I used an action that I created by my self using the levels option of PS. Yet every single photo has its own histogram so when I perform the action on a whole folder the results are not pretty much convincing.

I am wondering if there is any tool that allows you to enhance automatically a directory of photos and taking in consideration the properties of each one.

\$\endgroup\$

1 Answer 1

2
\$\begingroup\$

You can use ImageMagick with the auto-level or level flags.

convert input.jpg -auto-level output.jpg
convert input.jpg -level 1%,99% output.jpg

On Linux or Mac, you can use a bash control structure to perform the operation on multiple image files.

for f in *.jpg ; do
   convert "$f" -level 1%,99% "${f%.jpg}-level.jpg"
done

For Windows, you can install a bash shell, like Cygwin or Windows Subsystem for Linux.

Anyone who knows the native cmd or PowerShell commands for Windows, feel free to edit to add.

\$\endgroup\$
4
  • \$\begingroup\$ Thanks for your answer. I tried the first command line it works perfectly yet the bash script doesn't work it gives this error : ' ./enhance_photos ./enhance_photos: line 1: {rtf1ansiansicpg1252cocoartf1504cocoasubrtf830: command not found ./enhance_photos: line 2: syntax error near unexpected token }' ./enhance_photos: line 2: {\fonttbl\f0\fswiss\fcharset0 Helvetica;\f1\fnil\fcharset0 HelveticaNeue;}' ' \$\endgroup\$ Commented Oct 3, 2018 at 14:30
  • \$\begingroup\$ It looks like you typed the script in a word processor (references to rtf). You need to use a text editor. Not familiar enough with Mac to know what editor to use. \$\endgroup\$
    – xiota
    Commented Oct 3, 2018 at 18:33
  • \$\begingroup\$ Yes you're right. I may use atom and see if ti's going to work. Thanks for your assistance. \$\endgroup\$ Commented Oct 4, 2018 at 7:42
  • \$\begingroup\$ I used atom and the bash script is executed. Yet it gives me this error : convert: unable to open image '.jpg': No such file or directory @ error/blob.c/OpenBlob/3489. convert: no images defined `-level.jpg' @ error/convert.c/ConvertImageCommand/3288. I execute the bash script this way : ./enhance_photos. If you have an idea why it doesn't recognize the photos inside the folder, it would be great. \$\endgroup\$ Commented Oct 4, 2018 at 7:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.