Posted on 2007-08-26 19:12:11-07 by tjugo
Convering ico to gif makes background black
Hi,

I am using Imager 0.59 to convert ico files to gif. So far the module performs flawlessly with a little problem. After converting the ico image to gif the transparent background looks black.

I've been reading the Imager mail list archive and the documentation and after trying all the suggested tricks the converted image keeps the background black.

As an example take this image:
http://www.expedia.com/favicon.ico

basically what I am doing is:

use strict; use Imager; my $img = Imager->new(); $img->read(file=>'./favicon.ico'); $img->write(file=>'./favicon.gif');

And the resulting giff image will have a black background. I've tried stuff like:
$img->write(file=>'./favicon.gif', transp=>'threshold'); or stuff like: my $giff = $img->convert(matrix =>[ [ 1, 0, 0, 0 ], [ 0, 1, 0, 0 ], [ 0, 0, 1, 0 ], [ 0, 0, 0, 0 ], ]); $giff->write(file=>'./favicon.gif');

with the same result.
Any idea,
Thanks for your support!
Direct Responses: 5959 | 5961 | Write a response
Perl Weekly newsletter
A free weekly newsletter for people who are busy to read all the blogs. click here to check it out.