Can't locate auto/Image/Magick/GetPixel.al error
Posted: 2010-11-16T08:56:56-07:00
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.
If I can golf this, I'd be really happy too.
Thanx in advance.
Dp
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