Replacing colors in an image with ColdFusion - Anyone know how?

A reader sent in this request today:

I'm trying to find a way to leverage open source/built-in image manipulation to allow me to replace one color in an image with another determined by a user. Have you run into this before or do you have any suggestions?

So I was sure Alagad's Image Component would have this as it has a large number of methods, but it did not. (Alagad isn't open source or free but at 70 bucks it is a dang solution.) Rick Root's Image.cfc doesn't seem to have this either.

So does anyone else know of a solution that will do this?

Archived Comments

Comment 1 by MikerRoo posted on 12/29/2006 at 11:29 AM

Yes. Eyebatch 2 has a color replace function as well as lots of other, dead useful, tricks.

http://www.eyebatch.com/eye...

Comment 2 by david posted on 12/29/2006 at 11:40 AM

http://www.efflare.com/prod...

its a custom tag for coldfusion. I have personal experience
with their products and they perform really well.

try the 30 day demo

Comment 3 by david posted on 12/29/2006 at 11:50 AM

Use java.

http://www.jhlabs.com/ip/fi...

some free java filters. The person should look into using the "MAP COLORS FILTER" to do what he wants.

Comment 4 by Netito posted on 12/29/2006 at 4:02 PM

Is cfexecute is allowed, an external application like ImageMagick (http://www.imagemagick.org) gives you a lot of power in image manipulation, but perhaps is too complex for just color replace.

Comment 5 by John Farrar posted on 12/29/2006 at 8:33 PM

I have a wish list request in for Fireworks to build an SDK that would let us take graphics built in FW and process them with a script.

Comment 6 by Chris posted on 12/30/2006 at 4:31 AM

problem with efflare is it's a .dll...ugly
the other solutions are external programs, too complex or involved, etc...can't integrate them into a CF app easily...

use Flash. make an interface to upload, pick color, replace color, etc. using as2 bitmap filters or as3.
then on the backend use Alagad to save and manipulate the results. I have built a dynamiic image upload, crop, thumbnail app using this method but you could easily add a color pick/replace.

Comment 7 by Brian Love posted on 1/16/2007 at 5:49 AM

I have some code that allows you to change the color pallete of a GIF image quite easily using CF:

http://blog.brianflove.com/...