TrueColor images have black (0,0,0) set as their background color and
this cannot be changed.
According to the POD, the first call to colorAllocate() is supposed to
set that color as the background fill. This works with palette images,
but with TrueColor it is always black no matter what.
This issue has been reproduced in versions 2.46, 2.45, and 2.35. I have
attached a script that should create a 400x400 image with a gray
background but does not.
Subject: | gdbug.pl |
#!perl
use GD;
GD::Image->trueColor(1);
my $gd = new GD::Image(400, 400, 1);
$gd->colorAllocate(120,120,120);
binmode STDOUT;
print $gd->jpeg;