Re: Using Imager module to resample images
- From: zentara <zentara@xxxxxxxxxxxxxx>
- Date: Wed, 30 Jan 2008 08:58:30 -0500
On 29 Jan 2008 14:45:42 GMT, Abigail <abigail@xxxxxxxxxx> wrote:
_
zentara (zentara@xxxxxxxxxxxxxx) wrote on VCCLXIV September MCMXCIII in
<URL:news:vv6up3521ho9pu3io1l4qvsk0nag72mgvg@xxxxxxx>:
@@ On Tue, 29 Jan 2008 03:08:11 -0800 (PST), Jason Carlton
@@ <jwcarlton@xxxxxxxxx> wrote:
@@
@@ >2. How do I recognize an animated GIF from a static GIF?
@@
@@ I believe it's safe to assume a static gif begins with GIF87, and
@@ an animated with GIF89. But I'm not sure it's an absolute.
While it is true that a GIF87a image is static, and that any animated
gif image is a GIF89a one, it does not mean that GIF89a forbids static
images. GIF89a is an enhancement of GIF87a. It allows animated images,
but it also allows interlaced images and other features. It doesn't
mandate one.
Abigail
Yeah, it's not an absolute..... but the gif isn't 89a, then it won't
animate. So if it says 87a you can be sure it's a single image.
If it's 89a, then you test for multiple files
################################################
from perldoc Imager::Files:
read_multi
If you're reading from a format that supports multiple images per
file, use the "read_multi()" method:
my @imgs = Imager->read_multi(file=>$filename, type=>$type)
or die "Cannot read $filename: ", Imager->errstr;
As with the read() method, Imager will normally detect the "type"
automatically.
#################################################
So it seems like you can attempt to open the 89a with read_multi(),
and if you get an errstr, open it as a single file.
I havn't poured over every Imager perldoc, but there is a section on
GUESSSING TYPES in Imager::Files.
zentara
--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
.
- References:
- Using Imager module to resample images
- From: Jason Carlton
- Re: Using Imager module to resample images
- From: zentara
- Re: Using Imager module to resample images
- From: Abigail
- Using Imager module to resample images
- Prev by Date: Re: C's gotoxy() equivalent in Perl
- Next by Date: FAQ 1.1 What is Perl?
- Previous by thread: Re: Using Imager module to resample images
- Next by thread: Re: Using Imager module to resample images
- Index(es):
Relevant Pages
|