1

I know how to trim an image in Photoshop. (choose Image > Trim in Photoshop's menu)

Is there any method to trim a slice to get rid of extra transparent space?

1

1 Answer 1

1

Not an answer, but I don't have the rep for a comment yet.

What I do is hide all other layers that aren't part of the slice. Then I add (or enable) a background layer with a different color from the edges of the slice (usually white, black or red). Then I zoom in as far as I can and use the color picker to find where the fade stops and the solid background color begins, and put a guide there. This gets tricky if you have an oddly-shaped graphic that you're trying to slice, where you have to find the most extreme pixel along any given edge. Then it's either 'slices from guides' or re-adjusting the edges of the slice to line up with the guides manually. Then turn off that background layer before I save that slice with transparency.

I suppose another method would be to slice your images roughly, not caring about the exact pixels, then saving the images with transparency. Re-open the images and trim transparent pixels and re-save.

I'd definitely be interested in finding a better way, as this is laborious, time-consuming and error-prone.

4
  • Thanks for the background layer trick, are there any plugins or scripts can solve this problem?
    – clyfish
    Commented Sep 4, 2013 at 3:05
  • Now I use imagemagick's trim operator to speed up the slicing. First, export the slice to png, then convert slice.png -trim info:, then adjust the X/Y/W/H of the slice and export again.
    – clyfish
    Commented Sep 10, 2013 at 8:19
  • I create a photoshop script which uses imagemagick to trim the slice automatically. Github: github.com/clyfish/slicetrim
    – clyfish
    Commented Sep 24, 2013 at 5:23
  • Nice looking script, I'll have to give it a try, cause I tend to do a LOT of slicing. Commented Sep 24, 2013 at 13:20

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.