Hi,
Not sure it is really a "perl question", but after 4 hours tests I am getting mad :(
I want to print text on a picture. I tried with png and jpg format, the result is the same: The text is not displayed in the color that I want, but in a color that matches the color of the picture at the left of the text. Crazy? Yes!
It means for example: I work on a picture that has a black background and a yellow square on the left side. I print the text in "red" and the text is... yellow. Same for any colors.
The code:
use GD;
$testline="qwerty";
$jpg="test.jpg";
$im = GD::Image->new( $jpg );
$mycolor = $im->colorAllocate(255,0,0);
$im->string(gdSmallFont,135,6,$testline,$mycolor);
$pic_dyn="test2.jpg"; open IMG,">$pic_dyn"; binmode IMG; print IMG $im->jpeg; close IMG;
This is in jpg, if I make the test source picture in png, and save the result in png (or even in jpg), same problem: The text "qwerty" is in yellow where I have a yellow square on the left, in green where I have a green square, etc.
Any suggestion?
Thank you!
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.