Nigel Peck wrote:
> 
> Can someone please let me have some example code of setting the colour of
> text being added to an image, my current code is:
> 
> my $image = GD::Image->new( $data_path . '/voucher/voucher.jpg' );
> 
> # Write the date $image->string( gdGiantFont, 315, 198, $expiry_date , 0 );
> 
> # Write the voucher number $image->string( gdGiantFont, 270, 642,
> $unique_booking_reference , 8 );
> 
> I've tried various uses of colorAllocate with no success.

GD seems to create palette-based images by default, which means your colour will
be selected from those already in the image. Fix it by calling

  GD::Image->trueColor(1);

right before you create $image from the JPEG file.

HTH,

Rob

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to