New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests fail with PerlMagick and ImageMagick 7 #19
Comments
Works for me with ImageMagick 7... |
Strange... The versions might be differing? My versions are:
|
Ignore me, I think I confused all my testing environments... |
Ok. This works for me: x11-libs/gtk+-3.24.26 But that doesn't explain why test failed for you: even with the hidpi screen, the middle pixel should still stay green. And it is green on the picture in your log (in 2_transparent.t). |
I tried with #20 and I get the same failures for the first two failing tests, and new different incorrect values for the last one. The test command that I'm using is: Test log:
|
Can you try this patch and show output? diff --git a/t/2_transparent.t b/t/2_transparent.t
index 8cf0da7..f8bc7fb 100644
--- a/t/2_transparent.t
+++ b/t/2_transparent.t
@@ -4,6 +4,7 @@ use File::Temp;
use Image::Magick;
use Test::More tests => 4;
use MIME::Base64;
+use Data::Dumper;
BEGIN {
use Glib qw/TRUE FALSE/;
@@ -55,6 +56,7 @@ diag( encode_base64( $image->ImageToBlob ) );
my $x = $image->Get('width') / 2;
my $y = $image->Get('height') / 2;
my @middle = $image->GetPixel( x => $x, y => $y );
+diag(Dumper($x, $y, \@middle));
is_deeply( \@middle, [ 0, 1, 0 ], 'middle pixel should be green' );
my $found; |
With tihs patch, I have the following output:
|
Interesting. So while $x and $y have correct values, which on the image point at the middle of the green rectangle, somehow ImageMagick finds the almost-blue pixel there, which is actually on the blurred edge between blue and white. |
Maybe this will show anything useful? diff --git a/t/2_transparent.t b/t/2_transparent.t
index 8cf0da7..f733bba 100644
--- a/t/2_transparent.t
+++ b/t/2_transparent.t
@@ -4,6 +4,7 @@ use File::Temp;
use Image::Magick;
use Test::More tests => 4;
use MIME::Base64;
+use Data::Dumper;
BEGIN {
use Glib qw/TRUE FALSE/;
@@ -55,6 +56,16 @@ diag( encode_base64( $image->ImageToBlob ) );
my $x = $image->Get('width') / 2;
my $y = $image->Get('height') / 2;
my @middle = $image->GetPixel( x => $x, y => $y );
+diag(Dumper($x, $y, \@middle));
+diag($image->Get('base-rows'));
+diag($image->Get('base-columns'));
+diag($image->Get('density'));
+diag($image->Get('x-resolution'));
+diag($image->Get('y-resolution'));
+diag($image->Get('units'));
+diag($image->Get('size'));
+diag($image->Get('sampling-factor'));
+diag($image->Get("pixel[$x,$y]"));
is_deeply( \@middle, [ 0, 1, 0 ], 'middle pixel should be green' );
my $found; |
Here we go:
|
Basically, if Dunno, we can try to find any pattern in how exactly it transforms coordinates. diff --git a/t/2_transparent.t b/t/2_transparent.t
index 8cf0da7..b6489f9 100644
--- a/t/2_transparent.t
+++ b/t/2_transparent.t
@@ -4,6 +4,7 @@ use File::Temp;
use Image::Magick;
use Test::More tests => 4;
use MIME::Base64;
+use Data::Dumper;
BEGIN {
use Glib qw/TRUE FALSE/;
@@ -55,6 +56,21 @@ diag( encode_base64( $image->ImageToBlob ) );
my $x = $image->Get('width') / 2;
my $y = $image->Get('height') / 2;
my @middle = $image->GetPixel( x => $x, y => $y );
+diag(Dumper($x, $y, \@middle));
+diag($image->Get('base-rows'));
+diag($image->Get('base-columns'));
+diag($image->Get('density'));
+diag($image->Get('x-resolution'));
+diag($image->Get('y-resolution'));
+diag($image->Get('units'));
+diag($image->Get('size'));
+diag($image->Get('sampling-factor'));
+diag($image->Get("pixel[$x,$y]"));
+for (my $yyy = 0; $yyy < 5; ++$yyy) {
+ for (my $xxx = 0; $xxx < 50; ++$xxx) {
+ diag("$xxx,$yyy: ", $image->Get("pixel[$xxx,$yyy]"));
+ }
+}
is_deeply( \@middle, [ 0, 1, 0 ], 'middle pixel should be green' );
my $found; To compare this to the encoded picture from your logs |
|
Thanks for patience Okay, those things it found in the left top corner of the image do look like cells. Except that their color is completely wrong: black and purple-ish? I think at this point it'll be more productive to test PerlMagick on the image directly, without running Gtk-ImageView tests every time. This is the picture from your log of Here's a code to read it: use strict;
use warnings;
use Image::Magick;
use Data::Dumper;
my $image = Image::Magick->new(magick=>'png');
$image->Read('image.png');
my @pixel = $image->GetPixel(x=>300, y=>200);
print Dumper(\@pixel); If it doesn't show green [0, 1, 0], it's a bug in imagemagick. |
Script output:
Which indeed hints at a bug in imagemagick, but calling it directly from the CLI gives the correct result:
So it might be a bug in PerlMagick or Imagemagick indeed :/ |
Issue reported to the imagemagick project at ImageMagick/ImageMagick#3402. |
This is solved by enabling HDRI support when building PerlMagick. |
It seems that switching from PerlMagick and ImageMagick 6 to version 7 causes the tests to fail.
Some failures are similar to those in #18 (comment), but are happening even when the tests aren't run in parallel.
Test log:
The text was updated successfully, but these errors were encountered: