Take the 2-minute tour ×
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 6 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
    
Im still testing but transparent blue would change everything blue which may cause image issues. I believe it should be transparent background blue balloon_trans.gif. –  Matt Feb 21 '13 at 22:33
    
@graphicsman correct, I'll append advanced usage to my answer. –  JohnB Feb 21 '13 at 22:36
    
I had come across ImageMagick as a way to do this, but yes, command line discouraged me. If you're up for giving me specifics of how to make it work that would be excellent. I'm on Windows 7, all of this specific shade of bright pink wants to be removed (not just that around the edge), the images are all those in the directory C:\Users\Eric\Pictures\pngs\logos, and example image: i.imgur.com/8sVwjA5.png Is there any more information that would be useful? –  ete Feb 21 '13 at 23:02
1  
@ete, I've updated my answer. I tried to make it as beginner friendly as possible, but let me know if something is unclear or goes wrong and I'll do my best to help –  JohnB Feb 22 '13 at 2:03
    
It worked, thank you very much :) –  ete Feb 22 '13 at 13:33

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 imagemagick.org/script/index.php –  Matt Feb 21 '13 at 23:15

This worked like a charm for me:

http://photobatch.wikidot.com/action-color-to-alpha

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

 
discard

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.