[magick-users] perl pixel manipulator
Henjo
henjovr at gmail.com
Wed Oct 24 08:29:19 PDT 2007
I'm trying to create a perl subroutine which reads an image (png),
manipulates certain pixel values, and writes the modified image to disk.
So far, I'm just trying to load the image and write it back unaltered,
without touching the RGBA pixels.
But alas, it's not doing anything..
sub modifyImage {
# load image
$f = 'input.png';
$original = Image::Magick->new;
$original->Read($f);
$original->Set(magick=>'RGBA');
$blob = $original->ImageToBlob();
@rgbavals = unpack "C*",$blob;
# do stuff here
# access array of pixels somehow and modify it (@rgbavals ?)
$blob = pack "n*", at rgbvals;
# write image
$new = Image::Magick->new(magick=>'png');
$new->BlobToImage(@blob);
$new->Write('output.png');
}
What am I doing wrong? Could someone please correct my routine?
--Henjo
More information about the Magick-users
mailing list