Since GIF uses LZW compression, your bit-twiddling is
damaging the data severely. It's not like a bitmap (BMP)
file where there is a one-to-one correlation between bits
in the file and bits on screen. In fact, a one-bit change
can ruin your entire GIF from that point on. JPEG, while
it employs a different compression system, is likely to
suffer the same sort of damage.
First, use PNG. It's better for your application because it
can express more colors, and unlike JPEG, the compression
does not destroy any data, so the image you get out is
exactly what you put in. JPEG will take some liberties with
your image in order to compress it, so the output may be
substantially different from the input.
So with that established, no matter what image you use,
you will have to decompress it first. You can use a library
like
Image::Magick to do this for you. When you have this
in a regular "bitmap" format, you can go to town on it,
perhaps using something like
vec to twiddle your bits,
or any other method you can think of. When you're finished,
you can pack it back up as a PNG and fire it off.
Of course, the tricky part is finding a "sneaky" way of modifying the
bitmap image.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.