I have an image which has only one colour - black. The anti aliasing is done with semi transparent black pixels of various opacity. I want to swap all the black (including the semi transparent black) with another colour. I would like the other colour to be semi transparent in the same way.

Source image:

I've tried:

convert icons.png -fill red -opaque black out.png

However the semi transparent pixels turn out as solid back. I experimented with GD and had similar problems.


I still don't have a solution to this.

I would like the user of my web application to be able to pick the colour of the icons. They may be limited to 40 or 50 different colours but I would rather my web application is able to generate these rather than a Adobe Illustrator script or similar.

The background colour may also vary so the semi transparent Anti alias pixels are important.

I thought this kind of thing might be useful to other people also. If I figure out a decent solution I will be sure to include it here.

link|improve this question
feedback

migrated from stackoverflow.com Jul 24 '11 at 10:01

This question came from our site for professional and enthusiast programmers.

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
or
required, but never shown