I'm loooking for a way to determine if a layer has been flipped or rotated. I found this code in a post that gets the rotation for a text layer, but I'm not able to adapt it to other layer types (e.g. art layers or smart objects) or to determine if the layer has been flipped. Any help or pointers would be greatly appreciated!
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), charIDToTypeID('Trgt') );
var desc = executeActionGet(ref).getObjectValue(stringIDToTypeID('textKey'));
desc = desc.getObjectValue(stringIDToTypeID('transform'));
var yy = desc.getDouble(stringIDToTypeID('yy'));
var xy = desc.getDouble(stringIDToTypeID('xy'));
var angle = angleFromMatrix(yy, xy);
function angleFromMatrix(yy, xy)
var toDegs = 180/Math.PI;
return Math.atan2(yy, xy) * toDegs - 90;
Evaluating transformation values for Smart Objects has proven elusive for Scripting so far to the best of my knowledge.
And plain ArtLayers have no such »memory« as they simply contain the pixels that result from the transformation.
If you have a duplicate of the untransformed Layer one might be able to concoct a complicated Scripting approach, but that seems a bit excessive.