Reading width/height of a smart object
-
dpizzle
Reading width/height of a smart object
I'm looking to read the width/height value that appears when in transform mode of a smart object. Smart objects can be flipped and have negative width and height values. Am I correct to assume that there's no way to read this value through the regular means? I tried looking at the scriptlistener generated code when I'm setting a negative value but am still a pretty lost. Any help would be much appreciated.
-
Mike Hale
Reading width/height of a smart object
I have looked at getting the transform values from a smart object layer several times and I have not been able to find any way( regular or otherwise ) to get that info.
I know it must be stored in the layer as Photoshop has access to it. But like many other things the Photoshop GUI can do, it doesn't seem like it can be done with scripting.
I know it must be stored in the layer as Photoshop has access to it. But like many other things the Photoshop GUI can do, it doesn't seem like it can be done with scripting.
-
jacobolus
Reading width/height of a smart object
If you look inside a Photoshop file with a smart object, it will have 'Placed Layer Data' (key 'SoLd') as part of the layer info for that layer. The data inside is just a descriptor, and the relevant keys inside have char ID 'Trnf' (for "transform"), and string ID "nonAffineTransform", each of which is a list of numbers. The key 'warp' might also be relevant – it’s a much more complex structure – but I think in general the transform and non-affine-transform values should include all you need.
I don't know if that informational descriptor about a placed layer can be accessed by the automation system directly. There are a bunch of promising keys in PIStringTerminology.h related to "smart objects" and "placed layers" and "transforms", but nothing I’ve tried myself.
Saving the file to disk and then navigating through to the layer you care about is kind of an overkill workaround, and would take quite a bit of effort to implement, but it should work.
I don't know if that informational descriptor about a placed layer can be accessed by the automation system directly. There are a bunch of promising keys in PIStringTerminology.h related to "smart objects" and "placed layers" and "transforms", but nothing I’ve tried myself.
Saving the file to disk and then navigating through to the layer you care about is kind of an overkill workaround, and would take quite a bit of effort to implement, but it should work.
-
Mike Hale
Reading width/height of a smart object
Parsing a file is a bit of extra work and a bit of a kludge. I have not wanted/needed the info bad enough for that.
-
Nimai
Reading width/height of a smart object
I went pretty far down the path of reading in the PSD file, parsing, and extracting the rotation and scale for smart objects, but I didn't take it all the way - ran out of time and patience. I was using a Javascript implementation of a PSD reader but it didn't support reading in that SoLd key directly, so I was at the point where I'd need to write that.
My main reason for replying to this thread is to ask: What's the right way is to lobby Adobe to expose the smart object transform information to the scripting layer?
Thanks-
My main reason for replying to this thread is to ask: What's the right way is to lobby Adobe to expose the smart object transform information to the scripting layer?
Thanks-
-
pfaffenbichler
Reading width/height of a smart object
I would guess a feature request over at
http://feedback.photoshop.com/photoshop_family/
would make sense.
If a couple of users add their support maybe it will receive consideration.
http://feedback.photoshop.com/photoshop_family/
would make sense.
If a couple of users add their support maybe it will receive consideration.
-
kpt
Reading width/height of a smart object
What I did in my program was to place the smart object, then open it as its own document, fetch the document's width and height, and finally close the document.
-
kpt
Reading width/height of a smart object
... which doesn't work if the JPEG image has been edited in ACR: invoking Edit Contents opens up ACR instead of opening the JPEG image in its own document, thus preventing the script from reading the height/width. If anyone has a way of avoiding this, I'd be very interested
-
kpt
Reading width/height of a smart object
I'm a bit thick: just realized I could just open() the file itself, read the width/height and close the document!