adjust levels layer

Discussion of actual or possible Photoshop Scripting Bugs, Anomalies and Documentation Errors

Moderators: Tom, Kukurykus

ron osborn

adjust levels layer

Post by ron osborn »

I've spent the better part of a day and have not been successful. I'm trying to figure out how to use vb to add an adjustment layer in CS2 and set its 5 parameters (input black level, gamma, input white level, output black level, and output white level) .
In the scripting documentation it says to add an art layer and then set its .kind property while it is empty. I can add an artlayer and set its kind to 1 or 2 (normal or text) but not 6 (adjustment layer). I have also created an action to add an adjustment layer and call it from vb, but I can't set its parameters to anything different (it uses what was set in the action which I don't want to use.) I have also tried to use the adjustlevels method of an artlayer to change the parameters but I think that only works on a normal layer by changing the layer data. Using it on an adjustment layer causes an error. I also had little luck in checking the script listener to expose what might be going on (parameter-wise) when I add a new adjustment layer. What am I missing. My images are 16 bit/channel with only a background layer.
Thanks.
MickM

adjust levels layer

Post by MickM »

I noticed your post in the Adobe forum has been answered with reference to JavaScript. The ScriptListener is the only way to go here as far as I can tell. I'm not sure why you haven't been able to use it.

Just record creating a levels adjustment layer and examine the code. Look for the lines which include .PutInteger() and .PutDouble(). The numbers in brackets are the variables which you can use as arguments in your wrapper function call. There are five variables, four ints and a double (gamma). It's very straightforward.