Re: Re: I-worm/Klez and a GIF query/question
| From: | Hugh Bothwell | Date: | Sat, 04 May 2002 13:24:16 +0000 |
| Subject: | Re: Re: I-worm/Klez and a GIF query/question | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-96041@lists.php.net to get a copy of this message | ||
"R" <r@jumac.com> wrote in message
news:001501c1f369$060a52a0$0a6da8c0@lgwezec83s94bn...
> Hey,
> Thanks for replying,
> Do you by any chance have the code or functions that i can use to do this?
> even to output on jpeg should be ok.
> Cheers,
> -Ryan
If outputting a JPEG is ok, why bother? I guess you
could up the output quality to prevent blurring...
I don't have code to hand, but I can tell you
how to go about it:
Look up the Gif89a format spec; it will tell you
how to write the header (desired bits-per-
pixel, size, etc).
Count the number of different colors you use.
Set the bits-per-pixel to the lowest value
such that 2^bpp>= numcols+1, and encode
at bpp+1 actual bits per pixel, always referring
to entries in the _existing_ palette, one entry
per pixel. This is obviously less efficient than
the LZW expanding-dictionary scheme, but
avoids patent infringement.
I recommend writing this as a PHP function
that accepts an image structure and returns
a bit-string; that will make it very easy to
integrate into your scripts.
... if this sounds too complicated, you
could always hire me to do it instead (hint, hint).