Hi,
I have problem with allocating color onto a jpg image of mine. Everything is fine except the color of the text is blueish instead of black. I can't find what am I doing wrong.
This is what I tried first
$font = "arialbd.ttf";
$fsize1= 12;
$baseimg='emptywheel.jpg';
$txt[0]="First test";
$txt[1]="Second test";
$image = ImageCreateFromJPEG( $baseimg );
$black = ImageColorAllocate ( $image, 0, 0, 0 );
$white = ImageColorAllocate ( $image, 255, 255, 255 );
ImageTTFText ($image, $fsize1, 0, 370, 370, $white, $font, $txt[0]);
ImageTTFText ($image, $fsize1, 0, 170, 270, $black, $font, $txt[1]);
ImageJPEG( $image );
ImageDestroy ($image);
Then someone told me I should create a blank image, allocate the color and then copy in the my image. But that didn't help either.
$font = "arialbd.ttf";
$fsize1= 13;
$width = 740;
$height = 750;
$baseimg='emptywheel.jpg';
$txt[0]="First test";
$txt[1]="Second test";
$image = ImageCreate($width, $height);
$black = ImageColorAllocate ( $image, 0, 0, 0 );
$white = ImageColorAllocate ( $image, 255, 255, 255 );
// $image = ImageCopy( $image, $baseimg, 0, 0, 0, 0, 740, 750 );
$image = ImageCopyMerge( $image, $baseimg, 0, 0, 0, 0, 740, 750, 100 );
ImageTTFText ($image, $fsize1, 0, 370, 370, $white, $font, $txt[0]);
ImageTTFText ($image, $fsize1, 0, 170, 270, $black, $font, $txt[1]);
ImageJPEG( $image );
ImageDestroy ($image);
BTW: If I just try to put black text on an empty image (as opposed to my "baseimage" the coloring works fine.
I would apprciate any help. Thanks,
Gabor