Set background color for GD Lib imagerotate and imagecopy
I am using PHP 5 GD Lib to do some graphics manipulation and I cannot find a way to get around the black background that appears when rotating an image or copying an image to another (larger) image.
Assuming I am working on a JPEG file that is of course not transparent, how can I rotate the image using the GD Lib and end up with a white background / canvas and not a black background?
+1
source to share
1 answer
This comment is from the PHP documentation and the credit goes to "weareexit at yahoo dot co dot uk"
"If you want to place the image on a larger canvas that you previously created with imagecreatetruecolor (), but you don't want the default black background to surround it: use imagefill () AFTER imagecopyresampled ()."
+3
source to share