Henjo on  wrote...
| 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*",@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?
| 
I added a few weeks ago a Perl Pixel Iterator example to the PerlMagick
'demos' area.  I designed it to work in a simular way to the -fx
command but more perl orientated.  Typically it is installed in
/usr/share/docs/ImageMagick-perl-*/demos/

But you will need a recent IM to find it there.  Or you can download it
from the IM sources areas.


  Anthony Thyssen ( System Programmer )    <[EMAIL PROTECTED]>
 -----------------------------------------------------------------------------
  Please leave a wish after the tone and, very shortly it will be our command.
      - Smoke from a Magic Lamp   -- Terry Pratchett  ``Sourcery''
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/
_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to