Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Imager::GIF seems broken

by marto (Cardinal)
on Jan 05, 2020 at 15:04 UTC ( [id://11110982]=note: print w/replies, xml ) Need Help??


in reply to Imager::GIF seems broken

I can't speak for Imager::GIF, but simply replacing it with Imager in your example works without issue.

#!/usr/bin/perl use strict; use warnings; use Imager; my $gif = shift || die 'need an image'; my $img = Imager->new; $img->read(file => $gif) or die $img->errstr; $img = $img->scale(scalefactor => 0.5); $img->write(file => join '.', $gif, 'half', 'gif') or die $img->errstr;

Replies are listed 'Best First'.
Re^2: Imager::GIF seems broken
by Anonymous Monk on Jan 05, 2020 at 15:50 UTC
    Thanks marto but your example demonstrates why we need Imager::GIF. Using Imager to transform animated GIFs will only save the first frame of the animation. Imager::GIF does the dirty work of taking apart the animation, transforming each image, and putting it back together again.

      I'm glad you found a solution, your previous post would make a good patch.

        > a good patch

        I'm not sure if the documentation is broken, or the module itself. The docs are consistent with how Imager usually works (using "new" to make object and possibly load data, or using "read" on object to load data, then giving "file => $file" hash to write method). Patching the docs would get the current module working for people, whereas patching the module would make it conform to the docs and work like usual Imager code.

        🤔

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11110982]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (3)
As of 2024-07-22 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuli‥ 🛈The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.