(none) imager-devel
/ help / lists / applications / search /

scaling animated GIFs

From: Bernhard Graf (
Date: Thu 14 Jun 2007 - 16:29:23 GMT

  • Next message: Tony Cook: "Re: scaling animated GIFs"

    Hi everyone,

    I'm trying to find the right way to scale animated GIFs.
    While this task is easy in Image::Magick and impossible in GD, in Imager
    it seems possible, but cumbersome.

    ATM my example code looks like this (w/o error checking):

    my $img = Imager->new;
    my @in = $img->read_multi(file => $infile, type => 'gif');
    my @out;
    for my $i (@in) {
      push @out, $i->scale(xpixels => 60, ypixels => 60, type=>'min');
    $img->write_multi({file => $outfile, type => 'gif'}, @out);

    The resulting GIF only shows the last image of the animation, presumably
    because the resulting Image objects issued by the scale() method don't
    have any tags, as for example "gif_delay".
    Is that deliberate or is there an easy way to keep the tags (or
    transform for gif_left/ _top/ _screen_width/ _screen_height)?

    Bernhard Graf