19

I've been googling this subject and also searched in this forum, all I found were posts about removing semi transparent pixels, ie. not what I have a problem with.

Basically, I've added a layer to my image that has the same size as the image. Then I add something to the layer, way smaller than the entire image. Now I want a quick way to "auto crop" the layer so that the layer only spans over the pixels that actually contain something.

In GIMP I choose Layer -> Auto crop layer. But there doesn't seem to exist such an action in Photoshop. Does anyone know where I can find this tool?

EDIT : Ok this is pretty much the scenario.

I have an image that consists of a lot of layers. On a certain part of that image I want to create a magnifying effect. So

  • temporarily I flattened the image
  • copied a circled area
  • undid the flattening
  • pasted the copied circle on to a new layer

now I want to use: Filter -> Distort -> Spherize to give it a magnified effect. However, the spherize effect affects the entire size of the layer and not only where the content of the layer is. This makes the circle that I pasted not the centre of the sphere but rather the lower right corner of the sphere, resulting in a totally different effect than wanted.

I hope this clears the issue up.

3
  • If no pixels extend beyond the canvas you should be able to select the small element, invert the selection, and then clear (delete). If this does what you want you can make an action and do it with a single click (Button Mode) or assign a keyboard shortcut. Do you mean something else?
    – Mr.Wizard
    Jan 23, 2013 at 13:39
  • @Mr.Wizard thanks for the info! I tried what you said, unfortunately it didn't do what I'd hoped for, to be hones I don't think anything happened. I'll edit my question to point out what I'm trying to do and what the problem is. Jan 23, 2013 at 13:44
  • Okay, I'll look for that.
    – Mr.Wizard
    Jan 23, 2013 at 13:45

3 Answers 3

30

If I understand Photoshop layers correctly, I can assert that a layer is always the size of the canvas no matter what. A square inside of a layer may be smaller, but when it comes to effects, it'll be relative to the size of the canvas unless you make a selection.

If you want to achieve your effect, either paste that flattened circle into a new image, do your effect, and then paste it back in the original, or run the Spherize filter on the pasted layer while the item is selected (Ctrl-click the thumbnail in the Layers palette) and it should work the way you expect.

If you're looking for Auto Crop in Photoshop, I believe that Image > Trim... is what you want. But that crops the entire canvas, not individual layers.

1
  • Great answer! I sorted it out before I got to read this, actually using the first method you proposed. I tested out the second method you mentioned as well and that works great also. Thanks for your help! Jan 23, 2013 at 16:02
2

To "auto-crop" use the magic wand tool or quick selection tool and select the outside of what you'd want to crop to. Then select the crop tool and it will auto select the area that was selected in to crop. accept the crop and presto!

As for the spherize effect. Most effects like that can have their center point dragged to the right location.

1

Filters work on an entire layer unless otherwise specified - e.g., a selection. Ctrl-clicking a layer's thumbnail will create a selection based on the opacity of that layer's pixels. Any pixels on the layer that are 100% opaque will be 100% selected; those that are 25% opaque will be 25% selected, any transparency will not be selected, etc.

Additionally, you may save steps and time by using Ctrl+Shift+C to "Copy Visible". This will copy not just the currently-selected layer's pixels, but all visible layer's pixels, and will generally have the same effect as flattening, copying, unflattening. Another difference is that flattening can sometimes slightly alter layer effects involving luminosity, and can have other potentially undesired effects. "Copy Visible" will not have any changes to the visible pixels at the time you copy. It's truly a What-You-See-Is-What-You-Get scenario. And saving steps is a big bonus.

Your Answer

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

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