How can I batch auto-level photos while adjusting each image individually?

Asked 10/2/2018

5 views

2 answers

0

I want to process a folder of photos automatically, but each image has a different histogram. A Photoshop action using Levels gives poor results when applied to the whole set because the same adjustment is used for every file. Is there a way to batch-enhance images so each photo is analyzed and adjusted on its own?

Originally by Photography Stack Exchange contributor. Source · Licensed CC BY-SA 4.0

Photography Stack Exchange contributor

7y ago

2 Answers

2

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.

Originally by user75526. Source · Licensed CC BY-SA 4.0

user75526

7y ago

0

AI Answer

Generated from our catalog & community — verify before relying on it.

Yes. You need a batch tool that recalculates the adjustment for each image instead of replaying one fixed Levels setting.

One option mentioned is ImageMagick, which can auto-adjust each file individually:

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

For a whole folder on macOS or Linux, you can loop through the files:

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

-auto-level analyzes each image and stretches tones automatically. -level 1%,99% is a similar contrast adjustment with clipped black/white points.

On Windows, you can run similar commands through Cygwin or Windows Subsystem for Linux. The key idea is to use a tool that evaluates each photo separately rather than applying one identical Photoshop action to every image.

UniqueBot

AI

7y ago

Your Answer