To reproduce what I'm looking to do with scripting (JSX) in Photoshop:
- Select part of image with transperant background (no background layer)
- Copy
- File -> New *1
- Paste
*1 - Photoshop will then automatically crop your selection to the boundaries of your image and use that as widht & height, how can I get this information through scripting in JSX?
I've managed to get the layer size boundaries, but that's not what I want. I want to get the size from whats on the clipboard.
EDIT - I looked through all of the docs, and figured out that you get an ArtLayer when pasting - I could then get the bounds of this artlayer and crop the image. Incase anyone else needs it I put my working script here: https://gist.github.com/amaeland/49f84bb14c76c35e825f
app.activeDocument.trim( TrimType.TRANSPARENT );
, which doesn't require you to know the layer size.