R. Joseph Newton wrote:

Eamon Daly wrote:


Hi, all. I'm using Imager to create gifs, but the resultant
file sizes are /huge/. I'm writing the files out like so:


Are you doing animations?  If not, skip the GIFs.  You can get much
better depth [16 million] in a lot less space with JPEG files.
Some of the compression algorithms avaiable are loss-free, too.  No
matter how small the color table, each pixel is still going to take
its one byte when using GIF.  I see that you set a
gif_eliminate_unused flag, but I am sort of sceptical about how
effective this will really be.  I have never heard of a GIF making
such optimizations.

Joseph


I'm sorry, but there are numerous errors here.


First of all, I know nothing about this Imager package (and indeed, very little about Perl), but I suspect the other reply was correct. Check the documentation and you will probably find that the package simply does not do compression of GIF images. It will write uncompressed GIFs, but not compressed ones. The reason is that GIF uses the LZW compression algorithm, which is patented in some countries (the patent only recently expired in the US), and threats of royalty fees and legal action have caused MANY free software packages to stop supporting GIF compression.

Second, JPEG (actually JFIF) is a very poor replacement for GIF. JPEG compression is good for photographs and other realistic images, but not for icons, cartoons, and other things that GIF works well for (things that have relatively few colors and/or large blocks of the same color). When attempting to compress a cartoon, for example, you'll find that JPEG/JFIF will give *lower* quality and a *larger* file size than GIF. For this type of image, PNG-8 would be a better choice than GIF, and a much better choice than JPEG/JFIF.

Third, only in relatively bad cases will GIF require a byte for every pixel. For example, I just created a solid white 200 by 200 image. That's 40,000 pixels. The file size is 345 bytes. One byte per pixel is what you would get if no compression was used at all (probably what happened in this case, but not what happens in general), or if the compression performed so badly that it might as well have not been used (which is rare for typical images).

-Kevin
--
My email address is valid, but changes periodically.
To contact me please use the address from a recent posting.



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to