Skip to main content
Known Participant
March 31, 2024
Answered

How to get the stroke size of a shape layer.

  • March 31, 2024
  • 1 reply
  • 354 views

How to get the stroke size of a shape layer in Photoshop? For example, if the current rectangle tool creates a shape layer with a stroke size of 30 pixels, how can I retrieve this information?

This topic has been closed for replies.
Correct answer r-bin
try {

// Works only in Photoshop CC

var the_layer = activeDocument.activeLayer;

var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("AGMStrokeStyleInfo"));
r.putIdentifier(stringIDToTypeID("layer"), the_layer.id);

var ret = executeActionGet(r).getObjectValue(stringIDToTypeID("AGMStrokeStyleInfo")).getUnitDoubleValue(stringIDToTypeID("strokeStyleLineWidth"));

alert(ret);

} catch (e) { alert(e.line+ "\n\n" +e); }

1 reply

r-binCorrect answer
Legend
March 31, 2024
try {

// Works only in Photoshop CC

var the_layer = activeDocument.activeLayer;

var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("AGMStrokeStyleInfo"));
r.putIdentifier(stringIDToTypeID("layer"), the_layer.id);

var ret = executeActionGet(r).getObjectValue(stringIDToTypeID("AGMStrokeStyleInfo")).getUnitDoubleValue(stringIDToTypeID("strokeStyleLineWidth"));

alert(ret);

} catch (e) { alert(e.line+ "\n\n" +e); }
meadXAuthor
Known Participant
March 31, 2024

Thank you, you are really