After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 321431 - ImageMagick newer than 6.2.3 breaks TCImage.compare()
ImageMagick newer than 6.2.3 breaks TCImage.compare()
Status: RESOLVED FIXED
Product: dogtail
Classification: Deprecated
Component: Framework
CVS HEAD
Other Linux
: Normal normal
: ---
Assigned To: Dogtail Maintainers
Dogtail Maintainers
Depends on:
Blocks:
 
 
Reported: 2005-11-14 13:17 UTC by Muktha
Modified: 2005-11-22 21:07 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Proposed patch (1003 bytes, patch)
2005-11-14 13:20 UTC, Muktha
needs-work Details | Review
Log of my shell trying to reproduce (1.79 KB, application/octet-stream)
2005-11-15 20:03 UTC, Zack Cerza
  Details
revised patch (1.88 KB, patch)
2005-11-22 21:00 UTC, Zack Cerza
committed Details | Review

Description Muktha 2005-11-14 13:17:30 UTC
Noticed couple of things in the image comparison function.

1. Case when 'metrics' is specified in the image compare:
   The comparison function always returns the result as fail even if the image   
   files are same. This is because for the 'metric didn't fire' case, the check 
   made is that the length of the output of 'compare' should not be 1. But this 
   condition satisfies even when the images are same (since length of the 
   output of 'compare' will be 3). 
   I noticed that for error conditions, the length of the output of 'compare' is 
   '1'. Attaching a patch with this change.

2. Case when no metrics is specified in the image compare:
   Here too, the comparison function returns the result as 'fail' even for image
   files that are same. This is because, the 'compare' command does not return 
   an empty list when the images are same.
Comment 1 Muktha 2005-11-14 13:20:13 UTC
Created attachment 54728 [details] [review]
Proposed patch
Comment 2 Zack Cerza 2005-11-15 20:03:37 UTC
Created attachment 54798 [details]
Log of my shell trying to reproduce
Comment 3 Zack Cerza 2005-11-15 20:03:57 UTC
I couldn't reproduce this. How exactly are you invoking TCImage.compare(), what
is  output to the log, and what version of ImageMagick are you running?
Comment 4 Muktha 2005-11-18 10:00:22 UTC
1. In my script, the image compare was invoked as:

   label = "Image compare"
   image1 = "/home/mukta/image1.png"
   image2 = "/home/mukta/reimage1.png"
   TestImage.compare(label, image1, image1, metric='PSNR')
   TestImage.compare(label, image1, image2, metric='PSNR')
   TestImage.compare(label, image1, image1, metric='MSE')
   TestImage.compare(label, image1, image2, metric='MSE')

   The output in the log file was:
   2005.11.18 20:43:10     Image compare:  Failed - inf dB
   2005.11.18 20:43:10     Image compare:  Failed - 32.2696 dB
   2005.11.18 20:43:10     Image compare:  Failed - 0 dB
   2005.11.18 20:43:10     Image compare:  Failed - 2.54674e+06 dB

2. The version of ImageMagic is 6.2.5.
   $compare -version
    Version: ImageMagick 6.2.5 10/18/05 Q16 http://www.imagemagick.org
    Copyright: Copyright (C) 1999-2005 ImageMagick Studio LLC

3. Also, when I run the compare command on the commandline, it gives me an 
   output whose length is 3 and hence TCImage.compare() returns the result as 
   'failed'.
   $compare -metric "PSNR" ./image1.png ./reimage1.png z.png
   $32.2696 dB
   $48,48,PNG
   $
Comment 5 Zack Cerza 2005-11-22 20:09:52 UTC
Oh boy.

It looks like from ImageMagick 6.2.4 onwards, we need something like your patch.
Before that version, however, we need what's in HEAD now.

I guess this means we need to check the ImageMagick version, and use "is"
instead of "is not" if it's 2.6.4 or newer.

I'll try hacking up a new patch.
Comment 6 Zack Cerza 2005-11-22 20:16:04 UTC
clarifying title
Comment 7 Zack Cerza 2005-11-22 21:00:32 UTC
Created attachment 55110 [details] [review]
revised patch

OK, here's my patch that fixes the issue for newer versions of ImageMagick, but
keeps it working the same for older versions. It does this by parsing the
output of 'compare -version' to get the version string.
Comment 8 Zack Cerza 2005-11-22 21:01:20 UTC
Moving to ASSIGNED
Comment 9 Zack Cerza 2005-11-22 21:07:26 UTC
Just committed the fix.