I can't answer from any experience, but, here goes.
The image already has a set palette. Judging from the image I would say it already has all 256 colors allocated. You then print text on the image in green. If green isn’t already in those 256 colors, then it will have to overwrite one of the existing colors in the palette. Thus when writing the new image, the palette will be messed up. Perhaps you should use the
colorClosest function instead? (
$index = $image->colorClosest(red,green,blue)) That way you won’t change the current palette.
See
GD docs for more information.
I could be completely wrong, but no one else has answered yet. :)
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.