Photoshop Trim Tool?

Redcrown

Senior Member
Messages
2,024
Solutions
7
Reaction score
682
Location
US
Photoshop has long had a "Trim" tool that is supposed to crop off transparent edge pixels, but it does not work for me. It does nothing. It has always done nothing thru several versions of Photoshop.

Does it work for anyone? Is there a trick?

Here is a recent (Aug 2021) page at Adobe, with the simple steps that have been the same for years.

 
Photoshop has long had a "Trim" tool that is supposed to crop off transparent edge pixels, but it does not work for me. It does nothing. It has always done nothing thru several versions of Photoshop.

Does it work for anyone? Is there a trick?

Here is a recent (Aug 2021) page at Adobe, with the simple steps that have been the same for years.

https://helpx.adobe.com/photoshop/using/adjusting-crop-rotation-canvas.html
Works for me. Used it today. Has always worked for me. I use it in several actions and it’s programmed to F4 on my keyboard.

Typically I deep etch a product, drop the background out to white, trim all around the product then ad 2 cm of white canvas all around. Gives a neat tidy consistent look to all my product photography.
 
Also works for me too. The thing to remember is that the colour needs to be identical in order for it to be trimmed. JPEG compression often means that colours aren't actually uniform, despite appearing to be.
 
Perhaps you can give us more of an idea of the circumstances (layers) in which this is not working for you. Then we may be able to offer some asistance - "its working for me" is not really much help.
 
  • Like
Reactions: Lan
I can’t really offer much other than it works for me. The dialogue box for the tool is self explanatory so not much to say about that. It does need to be a plain solid colour in order to trim . Any variation on that and it will see that as an area not to be trimmed.



Until someone gives a bit more info about what is going on when doesn’t work I don’t know what to suggest.
 
Photoshop has long had a "Trim" tool that is supposed to crop off transparent edge pixels, but it does not work for me. It does nothing. It has always done nothing thru several versions of Photoshop.

Does it work for anyone? Is there a trick?

Here is a recent (Aug 2021) page at Adobe, with the simple steps that have been the same for years.

https://helpx.adobe.com/photoshop/using/adjusting-crop-rotation-canvas.html
If you shared you file on a file sharing site and/or posted the image here with transparency as a PNG, I bet a forum member could quickly determine the issue.
 
  • Like
Reactions: Lan
Apologies, and I feel a bit naive. After watching a number of videos where the Trim tool works, it finally dawned on me that I was expecting too much.

All the working demos have transparent pixels from border to border. My cases do not. After rotating an image, or straightening some lines, I usually end up with triangles of transparent pixels that do not extend to both edges. Since the Trim tool trims to the closest non-transparent pixel, I get no trim.

Duhhh! I should have known that. But it would be nice to have an option that trims whatever it takes to remove all transparent pixels. I suspect that is much more often the case.

Trim this:

f4961a3684634329a667556a17190f85.jpg
 
Thanks for letting us know!
 
It looks like that example image of the rotated rectangle is already trimmed as far as it is ever going to be trimmed. You’re done.

Trim does not exactly “remove all transparent pixels.” Trim removes all edge pixels that have the exact same color value (which can be transparent, as long as they are ALL transparent). AND, which is probably being missed here, it trims to the smallest rectangle that contains the shape. You already have that. It is not possible to trim to a smaller rectangle without trimming the magenta parts of the shape, so there is nothing for Trim to do here.

The real function of trim is to remove uniformly colored (or uniformly transparent) space outside one or more sides of non-transparent pixels. What you are showing does not show anything left to trim. Every side has at least some non-opaque pixels that already touch that side. That means on every side, pixels are not the same value all the way across that side, so Trim will not trim any further.

It seems like what you want is to end up with a non-rectangular shape. If so…you cannot do that. An image, especially an image in a standard format like PNG or JPEG or TIFF, must always be a rectangle.

If your goal is that you want that to appear as “not a rectangle” (no opaque background, irregular shape) as a layer or as an imported graphic in another application, what you have shown is already going to do that. The transparent pixels are doing that job. When that graphic is layered over something else in an application that properly handles transparency, it is going to look like that shape, and not a rectangle. Because the transparent parts all drop out, so it will effectively not look like a rectangle.
it would be nice to have an option that trims whatever it takes to remove all transparent pixels.
The transparent pixels already represent “nothing there”, the smallest possible rectangle containing the non-opaque shape has already been achieved, so the removal you want is already as complete as it is ever going to get with the standard image file formats we have today.
 
Last edited:
It looks like that example image of the rotated rectangle is already trimmed as far as it is ever going to be trimmed. You’re done.



It seems like what you want is to end up with a non-rectangular shape.
You almost make me curious to see a photo album of yours. ;-)

I think it's fair to assume the OP wants to trim like this:



6158e69bbb504fbeb3e17b0fc1c482f9.jpg



--
Mark
 
  • Like
Reactions: Lan
I think it's fair to assume the OP wants to trim like this:
I didn’t think of it that way…maybe they do want to trim it like that.

I don’t mind being wrong about that, what’s important is they get the right answer. But…if what you illustrated is in fact what they want, it still does not change the answer: That end result is not achieveable with Trim in Photoshop. Trim always takes out outside pixels of a single color or transparent value. But only just one value. To accomplish what you illustrated, Trim would have to take out both transparent and opaque pixels to get to your yellow outline, and I have never seen any option of Trim that was meant to do that.

The usual way to deal with that example is get the manual Crop tool and do it by hand.

If it has to be a fully automated answer like using Trim, Photoshop might not be the right tool. The funny thing is, Adobe already has the math to do exactly what you pictured, but not in Photoshop. There are two features in Camera Raw/Lightroom that can do it: Auto Crop when merging to panorama, and Constrain Crop when doing geometric transformations.

Just writing that sentence above, I got an idea. You could feed the unrotated image into Camera Raw/Lightroom if in a compatible format, go into the Geometry panel (or Transform panel in Lightroom Classic), make sure you turn on Constrain Crop, and finally do the rotation using the Rotate slider in that panel…do not rotate using any other method. I just tried it out and it looks like that would get this done.
 
Last edited:

Keyboard shortcuts

Back
Top