Can't locate auto/Image/Magick/GetPixel.al error

PerlMagick is an object-oriented Perl interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning PerlMagick.
Post Reply
tomred
Posts: 4
Joined: 2010-10-21T09:27:50-07:00
Authentication code: 8675308

Can't locate auto/Image/Magick/GetPixel.al error

Post by tomred »

Hi,

I have tried to port a script from one server to another but it looks like the GetPixel() method seems to have gone walk about.

Installed Packages
Name : ImageMagick-perl
Arch : i386
Version : 6.2.8.0
Release : 4.el5_5.3
Size : 307 k

Ok, I can see that my binary-installed version is not as up-to-date as it could be but I don't want to do a source install on my production server. I do have the GetPixels method (plural). Does anyone know who I might be able to get the Red, Green and Blue values from a given pixel under 6.2.8?

The actual goal of this bit of code is to establish the relative brightness of an area. This is to decide what type of compose (Differene or Plus) to use when creating a Composite image (actually simply to add a watermark onto an image). The following bit of code works fine under 6.5.

Code: Select all

    my @pixels = $tmp->GetPixels(
            geometry => $self->{watermark_geometry},                                                                   
            map         => 'RGB',
            normalize   => 'false',                                                                                    
    );
    my ($row, $col, $red, $green, $blue);
    for ($row = 1; $row < $self->{watermark_w}; $row++) {
        for ($col = 1; $col < $self->{watermark_h}; $col++) {
            my @pixel = $tmp->GetPixel(x => $row, y => $col, normalize => 'false');                                    
            $red    += $pixel[0];                                                                                      
            $green  += $pixel[1];                                                                                      
            $blue   += $pixel[2];             
       }                                                                                                             
   }           
   my $brightness = int(( ($red+$green+$blue) / (scalar(@pixels) ) / 65535  )*100);  

If I can golf this, I'd be really happy too.
Thanx in advance.
Dp
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Can't locate auto/Image/Magick/GetPixel.al error

Post by anthony »

Your IM is too old!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
tomred
Posts: 4
Joined: 2010-10-21T09:27:50-07:00
Authentication code: 8675308

Re: Can't locate auto/Image/Magick/GetPixel.al error

Post by tomred »

Acknowledged. There is a update for my distro that gets me upto 6.6.5-8.

Thanx,
DP.
Post Reply