Skip to main content
New Participant
October 18, 2016
Answered

Script for auto-adjusting Levels, possible or not?

  • October 18, 2016
  • 2 replies
  • 1604 views

One of the things I am currently using Photoshop for is editing my digitised black and white negatives. I digitise them with my Sony A7ii camera and not a dedicated scanner, which results in low contrast RAW images. I've all ready set up an action to convert the negative raw files to positive tiff files, but I still need to edit the levels for every single image. That got me thinking, but before getting in to learning how to script, I am just going to ask if this is possible at all... It would speed up my workflow tremendously.

Is there a way that a script can be written that automatically adjusts the levels black and white points to where the curve starts? So the black point will move to the first black on the curve, and the white move to the first white on the curve?

See the image to clarify what I mean.

femfqt.jpg

Thanks for anyone who is able to answer this question or help me in any way!

This topic has been closed for replies.
Correct answer maxwyss

This is possible. In fact, you would have two options:

a) analyze the histogram, and determine where the threshold would be, and then apply these values to the Levels function; this is pretty straightforward, but requres some programming

b) use the script recording plug-in to record what you do in the Levels dialog --> Options… --> Auto Color Correction Options dialog, and let that one do its work; this is quite simple and requires even less programming; it may OTOH require a bit more understanding on how that functionality works

You may add (maybe using Applescript or VBS) a control structure which allows you to run a whole folder.

2 replies

Jarda Bereza
Inspiring
October 18, 2016

var idLvls = charIDToTypeID( "Lvls" );

    var desc906 = new ActionDescriptor();

    var idAuCo = charIDToTypeID( "AuCo" );

    desc906.putBoolean( idAuCo, true );

executeAction( idLvls, desc906, DialogModes.NO );

http://sklad.bereza.cz/00-jarda/00_screenshot/2016-10-18_185139.jpg

maxwyssCorrect answer
Brainiac
October 18, 2016

This is possible. In fact, you would have two options:

a) analyze the histogram, and determine where the threshold would be, and then apply these values to the Levels function; this is pretty straightforward, but requres some programming

b) use the script recording plug-in to record what you do in the Levels dialog --> Options… --> Auto Color Correction Options dialog, and let that one do its work; this is quite simple and requires even less programming; it may OTOH require a bit more understanding on how that functionality works

You may add (maybe using Applescript or VBS) a control structure which allows you to run a whole folder.

LuukvdBAuthor
New Participant
October 18, 2016

Thanks! I feel a bit stupid that I completely missed the Auto function with the Levels. I just added this step to the action I all ready had. Thanks a lot!