I have a smart object in Photoshop CC which has been carefully distorted using Photoshop's 'Transform → Distort' function. Photoshop presumably manages a transformation matrix for this layer, and I'm wanting to access the six(?) numeric values for it.
Some values (such as translation, scale and rotation) are given in the transform bar at the top of the screen when the layer is being transformed, but not enough to form a matrix, unfortunately. I've tried to access the matrix values through AppleScript, but Photoshop doesn't seem to provide the relevant information.
The reason I'm trying to do this is so that I can recreate the transformation using CSS's transform
property with the matrix
function. For that, I presumably need the matrix which Photoshop stores for the layer.
Edit 1: Alternatively, how can I get the precise coordinates of each corner of the smart object? I can generate the transformation matrix myself if I have those coordinates.
Edit 2: The types of transforms Photoshop allows for smart objects means that it needs to be represented by a 3D transform matrix, so if Photoshop does internally use a matrix, then it'll be a 4x4 one. I've been looking through the PSD spec to see if I can extract the values from it manually, or else find the coordinates of the corners, but I can't see where it's stored. I suspect my best bet is finding the coordinates of corners and generating the matrix myself; I've been eyeballing it and it's working relatively well, but it would be nice to have the precise coordinates.
Edit 3: Incase this helps anybody, I've just noticed that if the smart object is in transform mode (Edit → Free Transform), guides will snap to the corners if you drag them in from the ruler, showing their position. Unfortunately they only seem to snap to 0.1 pixel increments even though it looks like the corners can be more finely controlled, but at least it's faster (and somewhat more accurate) than just guessing.