gideondsouza has asked for the wisdom of the Perl Monks concerning the following question:
I'm trying to just draw a string over an existing image loaded from disk.
I'm using the GD module from cpan.
I managed to draw the string fine, but the string shows in this weird transparent like color instead of plain black. I see the POD for colorAllocate and colorExact but I really don't get what theyr'e supposed to do, and how I should draw a black coloured string?
This is my code:
$to_print = "some string"; my $im = newFromJpeg GD::Image("somefile.jpg"); my $black = $im->colorExact(0,0,0); #also tried $im->colorAllocate(0,0,0); $im->stringFT($black, '/Open_Sans/OpenSans-Bold.ttf' ,12, 0, 100, 50, +$to_print);
The color returned is also a -1, So what is the right way to set black as a color?
It just prints a wierd transparent color, that looks a lot like the background of the image. (The background is a texture). And changing the RGB values doesn't help in any way!
Any help appreciated! :)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: how can I set a real color while drawing text with GD
by Loops (Curate) on Aug 08, 2013 at 19:05 UTC | |
by gideondsouza (Pilgrim) on Aug 08, 2013 at 19:39 UTC |