I have a .png image file of a company logo with blue foreground on white. Can I convert it to black foreground on transparent background, using freeware tools?
4 Answers
I've done this before using imagemagick's 'convert' but I barely remember the exact incantation. Google to the rescue!
Search for "imagemagick replace color". One of the link is this:
http://studio.imagemagick.org/pipermail/magick-users/2006-May/017672.html
Basically it's something like this:
$ convert input.png -fill to_color -opaque from_color output.png
If the color is exact then the above should do it. Otherwise use the fuzz option:
$ convert input.png -fuzz 5% -fill to_color -opaque from_color output.jpg
Example:
$ convert b.png -fill 'red' -opaque '#f2efe9' c.png
That will change the color '#f2efe9' to red in the file b.png and save the output as c.png
All credit goes to Anthony Thyssen from the google search result.
As for setting the transparency:
$ convert input.png -transparent white output.png
Good luck!
As you taged you question: gimp is good tool to do that.
-
can somone please tell how GIMP can do it? i had tried a lot of menu items, but not able to figure out– paseenaCommented Apr 7, 2011 at 22:40
Use the magic wand tool to select the area to colour correct. Then select the colour to change to by clicking the coloured square. Once that is done, use the paint bucket tool and click inside the selected area.
Also, Google is your friend.
As other people have mentioned, you can do this in GIMP and googling helps :P. But suppose that you are not sure which terms to google, here are the steps:
1- Change X color to Y color foreground
Place cursor over the image, right-click > Select > By Color. Click on an area with color X (in this case blue). All blue color will be selected. Then right-click > Edit > Fill with FG Color (where BG Color will have been set to color Y). Done; all X color is now changed to Y color.
2- Change Z color to transparent background
First, make sure that there is an alpha channel in the layer by selecting Layer > Transparency > Add Alpha Channel (if the option is greyed out then there is already an alpha channel, no further action needed). Then place the cursor over the image, right-click > Select > By Color. Click on an area with color Y (in this case white). All white color will be selected. Then right-click > Edit > Cut. Done; all Z color is now transparent.