I have a square image with a ragged edge: the transparent pixels outside the image "weave" in and out towards the image center, within some unknown range. This range may be different for each side. In Photoshop, is there a technique that would crop the image to the largest size possible with no transparent pixels remaining?

Ragged edge

1 Answer 1


Crop to Opaque script

enter image description here

...Maybe. The script can be a bit picky:

  • If you have any transparent or translucent areas inside the outer edges of the shape, it will probably crop more than you'd like: example image
  • It crops the selected layer.
  • Can't have more than one layer selected.
  • Layer needs to be rasterized (if it's not already)

If you need to run this in a batch process, you can launch scripts from Actions, which will allow you to do the cropping but also add "actions" before that, like say merging layers or anything else. Just start recording your Action and launch the script File > SCripts > Browse... and it'll be executed with the rest of the action.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.