adjustCurves

Photoshop Script Snippets - Note: Full Scripts go in the Photoshop Scripts Forum

Moderators: Tom, Kukurykus

number-six

adjustCurves

Post by number-six »

Needed this for my own uses and didn't turn up any examples from a search so...

Code: Select all// @include "/Applications/Adobe Photoshop CS3/Presets/xtools/xlib/stdlib.js"
var doc = app.activeDocument;
var curveArray = new Array(Array(0,16), Array(16,16), Array(128,128), Array(240,240), Array(255,240));

function curveEm(activeDoc, theLayer) {
   if (theLayer.kind == "LayerKind.NORMAL") {
      theLayer.adjustCurves(curveArray);
   }
}

Stdlib.traverseLayers(doc, curveEm);
Mike Hale

adjustCurves

Post by Mike Hale »

I think that you will find that you can't apply curves or most filters to a solidfill layer so if (theLayer.kind == ("LayerKind.NORMAL") would have the same effect. The solidfill layers are being trapped by the catch.

Mike
number-six

adjustCurves

Post by number-six »

Thanks Mike, you are correct.

I've edited the snippet to reflect this.
xbytor

adjustCurves

Post by xbytor »

This:
Code: Select alltheLayer.kind == "LayerKind.NORMAL"

should really be this:
Code: Select alltheLayer.kind == LayerKind.NORMAL

The first (if it actually does work correctly) does an implicit conversion of theLayer.kind to a String for the comparison, which is not what you typically want.

-X