Sometimes I want to modify images for a website and make them transparent. When I remove the background, background pixels are still visible and I always wondered what the best solution would be to resolve this.
I found this post of blogger Haishi that resolved it for me.
The method is done with GIMP, a free image editing tool. Just follow the next few steps:
- Open the picture in GIMP.
- In Layers window, right-click the layer and select Add Alpha Channel.
- Duplicate the layer.
- Hide the lower layer, then select the top layer.
- Use color selection tool to select background.
- Use Select->Grow menu to grow the selection by 1-2 pixels.
- Press Delete key to delete the background.
- Hide the top layer, show and select the bottom layer.
- Press Ctrl+Shift+A to unselect everything.
- With bottom layer selected, select Colors –> Color to Alpha… menu.
- Select the color you want to change to alpha and click OK to apply the filter.
- Turn on the top layer again.
- Optional, use Image –> Autocrop image to crop the image.
- Export to a png file.
You now have a perfect transparent picture, with thanks to Haishi.