I have an image I want to draw a 1px black border around. When I increase the canvas size the extra space will be transparent; I can't select a color here. Ordinarily I would increase the canvas by 2 transparent pixels, then placing a solid black layer underneath would do the trick.

However, my picture is a graph in PNG with a transparent background. If I try the above the whole background will turn black. How can I draw a border around a transparent image?

The original:
enter image description here

What happens if I enlarge by 1 (equally transparent) pixel around and slide a solid black layer underneath:
enter image description here

This is perfectly to be expected. If the original didn't have transparency only the extra pixels at the border would show in black. Hope this makes it more clear.

  • Hi @Stevenvh I'm not sure I follow. You have a png with transparent background, that you need to enlarge and add a border to without any working files (PSD file)? Would this be correct?
    – Ryan
    Dec 30, 2013 at 0:45
  • @Ryan - I added to my question to make it more clear. HTH. Thanks for replying.
    – stevenvh
    Dec 30, 2013 at 9:45

4 Answers 4


enter image description here

Here's how I did it (I'll explain for an original of 298x198:

  • enlarge the original by 1 pixel on all sides -> 300x200
  • create e new image, white, 298x198
  • increase this to 300x200. Since we're on the background layer here we can select a black border
  • create layer from background, so that we can add transparency
  • select white area (magic wand) and delete. We now have a transparent image with a black border
  • paste the actual image as new layer
  • merge down (don't flatten, that would remove the transparency)

This works, but while it doesn't take as long as writing it all down I feel there has to be a better way. I simply can't understand why you can only select a color when you enlarge the background. There's no reason for it. Adobe, please let us choose between transparency and a solid color for common layers too.


I think the best way of doing this is by using the single column/row marquee tool then just select all the excess and delete it. I'm not sure if it's gonna be a pixel-sized border but I hope this is what you're looking for.

  • I see what you mean, but I hope there's a better way. Thanks for your reply
    – stevenvh
    Dec 30, 2013 at 10:21


  1. Open PNG in Photoshop (example: 10x10 PNG with black circle in center) enter image description here
  2. Add a new layer. This will be called layer 1. (Ctrl + Shift + N)
  3. Fill in with any color (Alt + Backspace) enter image description here
  4. Expand canvas to desired size. The caveat is that the amount of increase on each side should be equal to the border thickness you want. In my example, I increase canvas size from 10x10 to 14x14, meaning 2 pz border on each side. (Image -> Canvas Size... : Ctrl + Alt + C)
  5. Make a new layer. This will be called layer 2. (Ctrl + Shift + N)
  6. Select all (Ctrl + A)
  7. Subtract selection from layer 1 (Ctrl+ Alt-click on layer 1 thumbnail) enter image description here
  8. Fill in layer 2 (Alt + Backspace) and turn off visibility for layer 1. Layer 2 is your 2px border. enter image description here
  9. Delete layer 1, merge Layer 0 and Layer 2. (Ctrl + E)
  10. The final image: enter image description here

This seems long, but is actually a very short process. If you're working with many PNGs, and all your PNGs are the same size, then you can record an action for this.

a. Open the action window.
b. Click the "new action" button.
c. Enter name and shortcut key combination (let's say Ctrl + Shift + F5) for the action and press "Record".
d. Repeat steps 1-9 above. Tip: In step 4, enter a percentage value instead of a pixel value if you want this to work for any PNG size. Although doing this will not ensure same thickness border for all images.
e. Stop recording the action.
f. Open any other PNG of the same dimension and press the shortcut (Ctrl + Shift + F5), Photoshop will do the work for you.

Hope this helps.


As far as I understand your problem, all you need is to find an easy way to erase the area that is used by your image from the background layer. What you could try is:

  1. Select your backgroundlayer
  2. Select all (Cmd + A)
  3. Hold Cmd and alt keys and Click on your image layer (the area filled by the image will be cropped from your selection)
    decrease the size of your selection by 2px
  4. Delete the selected area from your background
  • Sorry, I don't seem to have explained well. I only have a single layer. I added to my question hoping to make it more clear. Thanks for your reply anyway
    – stevenvh
    Dec 30, 2013 at 10: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.