Re: Read GIF file descriptor does not work in PerlMagick

Bob Friesenhahn <[email protected]> Thu, 14 Aug 2003 13:42:08 -0500 (CDT)
Newsgroups gmane.comp.video.graphicsmagick.bugs
Message-ID <Pine.GSO.4.44.0308141336540.26224-100000@scooby.simplesystems.org>
>
> The problem is that when I try to transform a GIF file $image->Read
> does not load the image and does no complain about anything. Then
> $image->Flip complains Exception 410: No images defined (Flip).

I am able to reproduce this problem (yay!).  There is no error
returned by your sample code because there is no code present to check
it.  By adding some error handling code it is possible to see the
error message.  Based on how and where the error is occuring, I
suspect a bug in the BLOB I/O subsystem.

This is the test code I am using now:

#!/usr/local/bin/PerlMagick
use strict;
use Graphics::Magick;

my $open=1;
my $status;

my $image = Graphics::Magick->new;
foreach my $file (@ARGV)
{
   if($open)
   {
      open(IMAGE, $file) or die $!;
      binmode(IMAGE);
      print("Opening file descriptor for \"$file\"\n");
      $status=$image->Read(file=>\*IMAGE);
      warn "$status" if "$status";
      close(IMAGE) or die $!;
   }
   else
   {
      print("Opening file \"$file\"\n");
      $status=$image->Read($file);
      warn "$status" if "$status";
   }
   print("Flipping image\n");
   $status=$image->Flip;
   warn "$status" if "$status";
   $file=~s/\./_t./;
   print("Writing \"$file\"\n");
   $status=$image->Write($file);
   warn "$status" if "$status";
   undef $image;
}


======================================
Bob Friesenhahn
[email protected]
http://www.simplesystems.org/users/bfriesen



-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01