Skip to main content
Participating Frequently
December 4, 2013
Question

How to save layers with cropping?

  • December 4, 2013
  • 1 reply
  • 1891 views

I want to export layers to files (basically what "Export Layers To Files.jsx" does) but with cropping each layer (to different sizes). I know how to crop a document from script, but that also crops all other layers (erases their content outside of the cropping area). So my question is - how do I keep/retrieve the cropped out content of the document (layers)? Or maybe there's a better approach altogether?

This topic has been closed for replies.

1 reply

Chuck Uebele
Community Expert
Community Expert
December 4, 2013

There's only one crop availble per document.  The only other option would be a layer mask.

Participating Frequently
December 4, 2013

Layer masks hide pixels but I need the exported images to be cropped (different size).

So my only option is to copy the layer, create a new document, crop it, save it and then return to the original document? I'm afraid that will take forever for bigger documents.

Chuck Uebele
Community Expert
Community Expert
December 4, 2013

Well, it might be a roundabout way of getting what you want, but if you use the layer mask method, you could make the script create a selection of the layer mask or vector mask.  Then you can get the bounds of the selection and apply a crop, making sure it doesn't delete the pixels.  Then you could have the script remove the layer mask.