in reply to Re^2: Perl GD problem with colors for text
in thread Perl GD problem with colors for text
If no colors are allocated, then this function returns -1.
Checking $mycolor, I found that it was set to -1 for all 2553 possible RGB combinations.
Assumption: Because the string function received -1 for the color value, it used the (first|last|?) value in the image's existing palette, thus explaining why the text appeared in the same color as the box.
I then converted test.jpg to test.gif with an image editor, and changed $jpg to "test.gif". $mycolor received a positive value, and the text appeared in the chosen color.
I then tried an explicit GD::Image->newFromJpeg on test.jpg, to no avail. I also tried converting to test.png, also to no avail.
It appears that colorAllocate works correctly when starting with .gif images, but not for .jpg or .png.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Perl GD problem with colors for text
by natol44 (Sexton) on Nov 28, 2009 at 08:23 UTC | |
|
Re^4: Perl GD problem with colors for text
by gmargo (Hermit) on Nov 28, 2009 at 08:00 UTC |