Copy link to clipboard
Copied
Hi,
is there a possibility to check if the smartfilter mask is pure white?
Kind Regards
Joe
Try
...var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
d.putReference(stringIDToTypeID("null"), r);
var r1 = new ActionReference();
r1.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("filterMask"));
d.putReference(stringIDToTypeID("to"), r1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
var pure_white = true;
try { app.activeDocument.selection.bounds; } catch (e) {
Copy link to clipboard
Copied
Try
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
d.putReference(stringIDToTypeID("null"), r);
var r1 = new ActionReference();
r1.putEnumerated(stringIDToTypeID("channel"), stringIDToTypeID("channel"), stringIDToTypeID("filterMask"));
d.putReference(stringIDToTypeID("to"), r1);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
var pure_white = true;
try { app.activeDocument.selection.bounds; } catch (e) { pure_white = false; }
if (pure_white)
{
app.activeDocument.selection.invert();
try { app.activeDocument.selection.bounds; pure_white = false; } catch (e) {}
app.activeDocument.selection.deselect();
}
alert(pure_white?"Pure white":"Not Pure white");
Copy link to clipboard
Copied
Thanks r-bin , that works great
Copy link to clipboard
Copied
Mr. r-bin
on my photoshop cc14 and cc18 gives me this error.
Copy link to clipboard
Copied
The current layer must have a mask for smart filters.
You can also check the AM property of the layer "hasFilterMask" before this script.
Copy link to clipboard
Copied
Thanks now it works correctly.