Read GIF file descriptor does not work in PerlMagick
Esteban Fernandez Stafford <[email protected]> Thu, 14 Aug 2003 12:17:24 +0200 (CEST)
| Newsgroups | gmane.comp.video.graphicsmagick.bugs |
|---|---|
| Message-ID | <[email protected]> |
Hello all,
I sent this email to the ImageMagick list a few months ago. Now I
wanted to try GraphicsMagick and I found the same bug again.
I am trying to do some image transformations on Gifs and Jpegs. It is
very important that I can read the files from an open file descriptor
and so far I am not having much success. Following is the program I am
using to get started with ImageMagick perl API. It only reads an
image, flips it and saves it to another file.
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).
First I thought my code was wrong, but the program works with JPEG
images very well.
Then I thought it might be that the GIFs I was using where corrupt or
wrong in some way. But then I tried to use $image->Read (set $open=0
in the program below) with the file itself (not the open descriptor)
and it worked!
use strict;
use Graphics::Magick;
my $open=1;
my $image = Graphics::Magick->new;
foreach my $file (@ARGV)
{
if($open)
{
open(IMAGE, $file) or die $!;
$image->Read(file=>\*IMAGE);
close(IMAGE) or die $!;
}
else
{
$image->Read($file);
}
$image->Flip;
$file=~s/\./_t./;
$image->Write($file);
undef $image;
}
E s t e b a n!
:wq
-------------------------------------------------------
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