I have a bunch of images that I want to re-size to make icons with.

I have found these images on Google and they are all 512*512 images but the spacing between the actual image (the non transparent part of the image) and the border of the image is not the same for every one of those images.

The thing is that I want to make all of them fit into 70% of the image, while excluding the transparent pixels and allowing semi-transparent pixels (the image shadow) to exceed this 70% limit.

I have tried to trim the image and then re-size it but I don't get the result that I want because the shadow is either truncated or it is included inside of the 75% perimeter.

Here is an image which explains the issue : image

Could you please tell me how to proceed ?

2 Answers 2


I'll give you a outline of what I would do.

First I would convince my client that this is a bad idea. But given that you probably have that covered; You wouldn't care anyway. People never do, untill they realize that scaling icons is never really a good idea.

Next I would consider something other than PS as this is one of those things where tools like, python, perl or Imagemagick may be better. If this wont do then i would consider photoshop scripting. The outline of the script would look as follows:

  1. Select your transparency:
    1. Save channel.
    2. Run treshold on that.
  2. Read the size of tresholded image:
    1. Load selection.
    2. Fill a new layer.
    3. Querry new layer position plus height and width. No theres no rasy direct way to do this.
  3. Padd with empty pixels where needed and crop.

Be prepared for 10-20% of images where this will fail.

  1. Trim all images' shadows
  2. Resize all images to the same size
  3. Make a Master file with:
    • Desired final size
    • Desired shadow
  4. Combine the images that you want with the master file so the images will be on the top layer and the shadow layer in the back. Now all the images will have same size and shadow.

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.