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

Re: scaling animated GIFs

From: Bernhard Graf (
16852@xyz.molar.is)
Date: Sat 16 Jun 2007 - 11:39:54 GMT

  • Next message: Bernhard Graf: "Re: scaling animated GIFs"

    Tony Cook wrote:

    > In most cases I expect you'll just need to copy gif_delay:

    Well, meanwhile I came to the conclusion that I'd better copy or convert
    all tags to the scaled image.

    > my @in = Imager->read_multi(file => $infile, type => 'gif')
    > or die Imager->errstr;
    > my @out;
    > for my $i (@in) {
    > my $out = $i->scale(xpixels => 60, ypixels => 60, type=>'min');
    > $out->settag(gif_delay => $i->tags(name=>'gif_delay'));
    > push @out, out;
    > }
    > Imager->write_multi({file => $outfile, type => 'gif'}, @out)
    > or die Imager->errstr;

    Now I stumbled across another problem: Transparency is lost.

    There is a tag, that tells which color is to be regarded as transparent.
    In my example GIF tag `gif_trans_color' is "color(255,255,255,0)".
    When I open source and result GIF files in GIMP I see that all areas
    that are (255,255,255) in the original are turned into (254,254,254) in
    the scaled result.
    Also after scaling the pallete has only 64 entries instead of 256 in the
    source GIF image, so I think, `gif_trans_index' which is 255 is wrong.

    -- 
    Bernhard Graf
    



  •