Skip to main content
Known Participant
June 24, 2023
질문

How to automate Photoshop's "Auto" Brightness/Contrast functionality on a batch of images?

  • June 24, 2023
  • 5 답변들
  • 3621 조회

If you add a "Brightness/Contrast" adjustment layer in Photoshop? You can click the Auto button to have Photoshop make its best guess on what would be best for the current image.

 

If you try to record this as an Action however, it just records the specific Brightness/Contrast settings that were used -- not the variable "Auto" functionality itself.

 

Is there a way to automate this via Photoshop scripting? Some kind of .jsx code?

 

Thanks!

5 답변

Conrad_C
Community Expert
Community Expert
June 25, 2023

I agree that Brightness/Contrast is a bit of a blunt instrument. You sbould be able to get more consistent results another way, and also much more easily than what you propose.

 

Instead of trying to gain programmatic access to the Auto button in Brightness and Contrast, consider creating an action that uses one or more of the Auto correction commands that are already conveniently available on the Image menu: Auto Tone, Auto Contrast, and Auto Color. Descriptions of what all three do are on the Adobe help page Make Quick Tonal Adjustments.

 

Furthermore, what those commands do is not set in stone. You can adjust the target colors and default clipping values you want, as described on that Adobe page. Some more background about how those work is in an article by Bruce Fraser, Don’t Underestimate Photoshop’s Auto Color. Although written in 2022, the description of Auto Color options still applies today. (What it calls Auto Levels is now Auto Tone.)

 

If you want the latest and most advanced automatic correction trained using machine learning, then I agree with the suggestion to run the images through the Auto Settings command available in Adobe Camera Raw or Lightroom Classic, if the image file types are compatible. The advantage here is that you can select any number of images, apply Auto Settings, and it will batch process the lot — without having to create an action or write a script.

 

If you do it with Camera Raw, I don’t mean not Camera Raw as a filter in Photoshop, but Camera Raw as the processor: That is what will let you batch apply immediately. To use Camera Raw that way, you would first use Adobe Bridge to select all the images, then choose File > Open in Camera Raw, then select all the images there. For Lightroom Classic, you would import all the images, then select them all. In both cases you would export corrected copies.

Known Participant
June 25, 2023

I ran an experiment to test this. I manually adjusted the Brightness level of 100 images to what I believe made them look best. I then compared that against Photoshop's "Auto" Brightness level. On average, there was a difference of only about 1.0 Brightness points between me and Photoshop for the full batch -- which, statistically, is almost meaningless. Additionally, 80% of Photoshop's Auto brightness adjustments were within 20 brightness points of what I would've done manually, and about 60% were within 10 brightness points. 0% of them were over 35 brightness points in difference -- ie so wildly different from my decision that the brightness would look very bad. 0% of the images that I looked at looked so horrendously bad that they made me say: "This looks awful because of the Auto brightness settings that were applied."

The trick to making it work for my workflow is, use it to just Auto adjust the Brightness, then revert the Contrast back to 0. Brightness + Contrast on Auto often looks terrible. Using it for Brightness only, however? It actually has a pretty good eye for, how much brighter an image needs to be to look optimal. At least, compared against how I would do it.

Nancy OShea
Community Expert
Community Expert
June 25, 2023

Whatever you say. 

That's not my preferred workflow for commercial projects.

Best of luck.

 

Nancy O'Shea— Product User & Community Expert
Nancy OShea
Community Expert
Community Expert
June 24, 2023

Auto adjustments are hit & miss.  Sometimes they work well and other times they make a mess.  It really depends on individual image exposure and what needs correction.  I see no way to successfully batch this. 

 

For better control,  I recommend using Levels or Curves Adjustments on each image separately. 

 

Nancy O'Shea— Product User & Community Expert
Stephen Marsh
Community Expert
Community Expert
June 24, 2023

The Brightness/Contrast command is one of the legacy commands that was often inferior to other methods when used with photographic images, compared to levels or curves. Adobe then improved the code and added the legacy checkbox for the old behaviour.

 

In addition to auto options in the traditional commands, there is also the auto command in the Camera Raw filter, which can be scripted and automated:

 

Legend
June 24, 2023
var d = new ActionDescriptor();
var r = new ActionReference();
r.putClass(stringIDToTypeID("adjustmentLayer"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
var d2 = new ActionDescriptor();
d2.putBoolean(stringIDToTypeID("auto"), true);
d2.putBoolean(stringIDToTypeID("useLegacy"), false);
d1.putObject(stringIDToTypeID("type"), stringIDToTypeID("brightnessEvent"), d2);
d.putObject(stringIDToTypeID("using"), stringIDToTypeID("adjustmentLayer"), d1);
executeAction(stringIDToTypeID("make"), d, DialogModes.NO);
Stephen Marsh
Community Expert
Community Expert
June 24, 2023

@r-bin - thank you!

Known Participant
June 24, 2023

The best solution I can think of is, a .jsx file for Photoshop scripting that opens each image file from the desired folder, adds some default brightness/contrast layer, quite literally sends an arbitrary mouse click to the active window to click the Auto button, waits 5-30 seconds (depending on how safe I want to be to ensure it runs to completion), then finishes the job via more .jsx code to save the image and close the current document, then rinse and repeat until I'm done with the entire folder. Best idea I've got, given that this apparently can't be done EITHER via Photoshop scripting OR via Photoshop actions.