# Calibrate standard rainbow colors from different bicolor images

I'm trying to figure out an efficient way (whether using Photoshop actions or whatnot) to convert a series of bi-color images into rainbow color calibration variations

Here is a sample input image (checkered bg is photoshop transparency of course):

I'd like to automatically convert it to the red, orange, yellow, green, blue, indigo, violet color version. Each input image would have a different base color.

I don't have a good method right now other than to do Layer Hue/Sat adjustments and eye it. I have hundreds of these to convert.

• You said "calibrated". What kind of calibration you expect? Know that an actual rainbow has continuous wavelength variation from about 400 to 700 nanometers across the bow. The limitations (=spectral resolution is only three wavelength bands which in addition overlap) of our sight makes us to see colored bands with blurred edges.
– user82991
Mar 14, 2021 at 11:54
• @user287001 - I think the OP is just using the word "calibration" in the colloquial sense of a standard scale or method of computing, in this case the standard colours of the rainbow. Mar 14, 2021 at 12:08
• @BillyKerr That's possible, but asking a mechanical method and talking about calibration rises an idea that the questioner actually wants to do something non-artistic, which he wants to keep secret and he has based his solution on a 100% misconception of color.
– user82991
Mar 14, 2021 at 12:19
• Calibration perhaps using the Color sampler for each of the 7 rainbow colors?
– ina
Mar 14, 2021 at 22:28

It's not possible to determine whether the darkest point in each image is in fact 100% tint of a color or perhaps a lighter tint of a darker color.

Assuming that you want the darkest point in every image to be the chosen color you could record an action as explained below. There will be some deterioration of the images, but perhaps it won't be visible to the naked eye. Depends on how light the original colors are.

• In the Actions panel, start recording a new action.

• Create a Vibrance adjustment layer. Set Saturation to -100. This desaturates the image.

• Create a Levels adjustment layer, Alt + click the Auto button, select Find Dark & Light Colors and click OK. This makes sure that the darkest point in the image is black and that the lightest point is white.

• Create a Solid Color layer, select the color you want and click OK.

• Alt + click between the solid color layer and the layer below to create a Clipping Mask. This makes sure that the solid color layer has the same transparency as the image.

• Set the Blend Mode of the solid color layer to Screen. This way the color is applied at 100% tint in the darkest point and fades to white the lighter the underlying pixel is.

• Finally use Layer > Merge Visible.

• End the action recording.

Now you have an action for one of the seven colors you want. You'll have to make duplicates of the action and edit the solid color layer to get an action for each color.

These actions can be applied to a folder of images using File > Automate > Batch.

You could make copies of your image folder and apply the actions one at a time, manually keeping track of the files. You could also add to the action that you save the image into a folder for that specific color, change the color, save to the next folder and so on.

I don't think I'll go into details about how exactly to do this as it will become a bit tedious to explain. Feel free to ask for clarification.

• Thanks this helps tremendously and thanks for the screen recording! Curious why not color and why screen?
– ina
Mar 14, 2021 at 23:56
• Easiest to show with example. Color blend mode doesn't do what you want. It preserves black and the chosen color is achieved at 50% black (I think). Screen on the other hand will make 100% black your chosen color and fade to white as the image gets lighter. Mar 15, 2021 at 0:06
• thanks again! this helped me make chakra particles for this PiDay SundayHackDay AR app twitter.com/Yosun/status/1371321898294931456
– ina
Mar 15, 2021 at 8:43
• Ah, that's fun to see! You're welcome. Mar 15, 2021 at 15:17

Photoshop can't see colours, and has little to no decision making capabilities. So it can't for example see a colour (or measure a colour), then make a decision on how much to adjust that colour to reach some desired goal.

So, with that in mind, I think what you'd need to do is perhaps something like desaturate the image entirely, make it black and white, then you could apply a hue-saturation adjustment, using the "colorize" option, to achieve your desired colour. This could be recorded as an action, so for example any image you input could be output as a specific colour.

As to automating this using actions and batch processing, there's another problem. You are trying to output different variations of the one image file. Batch processing doesn't work like that. You need to have one image, which is then output as a different file. It's a one-to-one process. If you were to try to use an action to do this repeatedly for each colour, and save each result, the file would just be overwritten for each colour variation. You may be able to address this using a script, but I think it's too complex a task for actions and the batch processor alone.

One possibility, which may or not be practical, would be to duplicate your image file folder 7 times, one for each colour variation. Set up a separate action for each colour variation (7 actions). Then run each action as a batch on each of the folders in turn.