[DFW.pm] Changing colors in a gif using cgi

Robert Flach rflach at corp.hrsmart.com
Sat Jan 5 18:06:42 PST 2013


I would assume you could accomplish this with PerlMagick...


and a quick internet search reveals:

http://stackoverflow.com/questions/2350740/how-do-i-replace-any-color-that-is-not-a-specific-color-using-perlmagick


The basic syntax is

use Image::Magick;
my $image = Image::Magick->new;
$image->Read('x.gif');
$image->Opaque(fill => 'black', color => 'red');
$image->Write('x_changed.gif');

Robert Flach


From: Dfw-pm [mailto:dfw-pm-bounces+rflach=hrsmart.com at pm.org] On Behalf Of Jerry Kassebaum
Sent: Saturday, January 5, 2013 7:29 PM
To: dfw-pm at pm.org
Subject: [DFW.pm] Changing colors in a gif using cgi

How do I change colors in a gif using cgi or perl? In other words how do I read a file in binary or hex, change some bits or bytes, and write it back?

A very simple file is attached if you want to use it.

My long-term goal is to start with all black, then blacken every color except, say, a00000 to afffff, then everything except, say, 200000 to 2fffff AND a00000 to afffff, etc., until the user can guess what the picture is.

Jerry Kassebaum
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/dfw-pm/attachments/20130106/dd323ae2/attachment.html>


More information about the Dfw-pm mailing list