Sign up ×
Graphic Design Stack Exchange is a question and answer site for Graphic Design professionals, students, and enthusiasts. It's 100% free, no registration required.

I have a very large number of PNG images (too many to practically do one at a time) with a bright pink background and would like to replace the background color with transparency. If this is not possible or particularly difficult, replacing the specified color with white would be useful.

I have gimp but not photoshop and am not particularly comfortable with command line, so if a solution requires that please show each step. It'd be great to be able to do this, any help would be appreciated.

share|improve this question

3 Answers 3

up vote 7 down vote accepted

I know you said you're not comfortable with command line tools, but ImageMagick can do this:

Replace a Specific Color

convert balloon.gif -transparent blue balloon_trans.gif

enter image description here enter image description here enter image description here

Where balloon.gif is the source image, -transparent specifies that you want a transparent bg, blue is the color you want to replace, and balloon_trans.gif is the completed image.

This is under the assumption that your "bright pink" is not part of any of the images. For a little more intelligent background removal (floodfill), check out this tutorial: Masking Simple Backgrounds (floodfill)

This can get a little hairy and some of the options they specify there probably aren't required for what you're trying to do, so as @graphics man suggests you can add background to the command

If you can tell me what OS you're using and a sample image, I can help you with a script to automate this for many images

Specific to your situation:

First, install ImageMagick. You may need to restart after installation for your PATH variable to be updated (I did)

Once it's installed, fire up a command prompt (Start Menu, type cmd, hit enter)

You need to change directories to where the images are saved. For your situation, enter the following command:

cd C:\Users\Eric\Pictures\pngs\logos

Now we need to make a folder to save all the images in:

mkdir batch

And now, the command to convert all the images:

FOR %G IN (*.png) DO convert %G -transparent #FF00FF batch\%G

If everything went smoothly, the newly saved images should be in the batch folder you created.

enter image description here enter image description here enter image description here

share|improve this answer
good solution, if anyone wondering equivalent linux bash: for file in *.png ; do convert "${file}" -transparent '#ffcc66' "batch/${file}" ; done – Sameer Shemna Oct 21 '14 at 10:08

If you are running gimp and are not wanting to go Imagemagick you might want to take a look at David’s Batch Processor (DBP). It is a plug-in for gimp for batch processing. Note I have never used it nor tested it but it was something I have seen used before. If you had Photoshop I could show you how to use the batch or action.

share|improve this answer
I have that and have used it to mass crop these images, but there does not appear to be any option to replace colors. Maybe I'm missing it though, or have an old version? – ete Feb 21 '13 at 23:11
I do not know. I'm just familiar with the plug-in because a client was using it to mass edit images and was getting an error. As John has posted Imagemagick is a powerful option and could solve all your problems. There site is very detailed. Have a look – Darth_Vader Feb 21 '13 at 23:15

This worked like a charm for me:

Phatch is a Photo Batch Processor. Color to alpha action does exactly what you are looking for:

"The value of the color which should become transparent"

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.