List Info

Thread: Possible bug in Image::Magick?




Possible bug in Image::Magick?
user name
2006-12-05 04:02:45
We're using Perl's Image::Magick interface, and have tested
against  
6.1.5 (production) and 6.2.4 (staging).  We have some JPEG
images  
that return type 'Grayscale' when we ->Get that
attribute; we need  
them to be TrueColor for a downstream blackbox.

Using ->Set to make 'type' => 'TrueColor' does not
work (->Get 
('type') still returns Grayscale, and the blackbox chokes as
it does  
on all 'grayscale' JPEGs).  [From my genius programmer
colleague:   
"very odd. i'm pretty sure this is a bug: the docs even
say ''For  
example, to prevent a JPEG from being written in grayscale
format  
even though only gray pixels are present, use...''"]

I hacked a method that *does* work, by finding a gray pixel
and  
changing one of the RGB values by one (e.g., from #e7e7e7 to
 
#e7e7e8); once that's done ->Get('type') returns
TrueColor.

However, we appear to lose that change (the pixel, and the
TrueColor  
type) when an image is moved from image to blob and back to
an  
image.  Example:

my $image = Image::Magick->new();
$image->BlobToImage($image_data_from_database);			
print "Image type: " . $image->Get('type') .
"n";	# outputs Grayscale
$image->Set('type' => 'TrueColor');
print "After ->Set(): " .
$image->Get('type') . "n";	# outputs  
Grayscale and image breaks the black box
forcetruecolor($image);					# finds the pixel, sets the blue
value
print "Post-subroutine: " . $image->Get('type')
. "n";	# outputs  
TrueColor

my $data = $image->ImageToBlob();	
my $new_image = Image::Magick->new();
$new_image->BlobToImage($data);
print "Final: " . $new_image->Get('type') .
"n";	# outputs Grayscale



Have we actually discovered bugs?  Here's the output from an
actual  
program run:

Image type: Grayscale
After ->Set(): Grayscale
Post-subroutine: TrueColor
Final: Grayscale

Been fighting another fire here, but I'm going to see if I
can get  
6.3.x up and working with Perl::Magick on a VMWare instance,
to see  
if it persists...

Thanks!
Chris

_______________________________________________
Magick-developers mailing list
Magick-developersimagemagick.org
http://studio.imagemagick.org/mailman/listinfo/m
agick-developers
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )