Welcome to WebmasterWorld Guest from

Forum Moderators: coopster & jatar k & phranque

Message Too Old, No Replies

Perl script to alter an image

Replace color with alternate color



4:52 pm on Dec 19, 2005 (gmt 0)

10+ Year Member

Does anybody know of a perl script that will take a GIF file and replace all pixels of a specified color with an alternate color?

I have some real-time images that are produced by a third party and the background is always black. I want the background to be white. So I'll have to process the image to alter the background color everytime the image is accessed.


4:08 am on Dec 20, 2005 (gmt 0)

5+ Year Member

Look at GD::Image (I think it's called) and PerlMagick (the perl stuff from Image Magick).



3:35 pm on Dec 20, 2005 (gmt 0)

10+ Year Member

Tony Cook's perl module Imager-0.46 on cpan.org comes with a sample script that does exacly what I need. The script and associated docs are called replace_color

Featured Threads

Hot Threads This Week

Hot Threads This Month