I have a large number of photos which I want to bring to the same ‘level’ -same colors / brightness / contrast etc. To this end I have one initial / guide with a black & white color checker (basically the squares with colors), which I added to all other photos.
This is the initial / guide https://imgur.com/a/Jlozy1e and these are some of the photos https://imgur.com/JUsKMt2 , https://imgur.com/PvqsleR , https://imgur.com/tcMROU9
As I see it the area with the little square colors (color control squares) must be the same color (hex value) in all photos in order for them to be at the same level -so I can get meaningful data from the strip below.
Is there a way to do with an automated / batch way in photoshop or some other tool?
EDIT: Note that there might be darker / lighter areas than those in the control squares which i want to preserve them (just get lighter/darker accordingly but not completely replace them with a threshold color)
3
Answers
I don’t know if this is possible with any advanced tool but here’s my take in Photoshop. The idea is quite simple — use a gradient map to remap target colors to source values (hence this won’t work on 32bit tiffs):
Here’s the result I got: left row are original documents with a piece of the source squares on top of them for a reference, right row are result documents with the gradient map applied and the same slice from the source doc on top (barely visible):
And here’s the script I made.
Note that I was using your png files so if your files are different size you might need to adjust coordinates for color samplers.
I would automate this with ImageMagick which is installed on most Linux distros and is available for macOS and Windows.
First, I would run a script to get the black and white points from your calibration image. This crops out a 50×50 square from the black and white ends of the calibration strip and calculates their mean values averaged over the 50×50 square. That looks like this:
And you would run:
and get the following output:
So now we know that the mean brightness in the red square is 5, and the mean brightness in the blue square is 91 and we can check where the squares were extracted from too.
Now we need to apply that to the other images. Let’s just do one first. The code for
apply
is:So, if we run that and apply the calibration we just learned of 5, 91 to
im1.png
we get:That gives us this corrected image (with the white considerably raised):
and this check image showing which areas we calibrated from:
So then we just need a loop to do all the images in a directory:
That gives us these results:
Keywords: ImageMagick, command line, command line, image, image processing, calibrate, calibration, calibration strip, test strip.
Note that if you use ImageMagick v7 or newer, replace the command
convert
withmagick
throughout both scripts.If you want to do it with Photoshop, you need to get an averaged value for the black calibration square in your calibration image by opening the histogram window and then drawing a marquee over the black square and noting the mean (11.89):
Then like wise for the white calibration square noting the mean value 231:
Then you need to get the same two values in your uncalibrated image. The black value is 10:
And the white value is 180:
Now add a Levels Adjustment Layer (see green area) and put in the values from above (blue area):
So, I guess you can make a shortcut that adds a Levels Adjustment Layer with the two values from the calibration image programmed in and batch apply it to all your images. You’ll just then need to manually add the other two values for each specific image.