A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearSet background color for GD Lib imagerotate and imagecopy - page 1
User InfoPosts
Set background color for GD Lib imagerotate and imagecopy#1
I'm using PHP 5 GD Lib to do some graphic manipulations, and I can't find a way to get around the black background that shows up when you rotate an image or copy an image to another (larger) image.

Assuming that I am working with a JPEG file, which of course is not transparent, how can I rotate the image using GD Lib and end up with a white background / canvas, rather than black background?

posted date: 2008-12-09 08:50:00


Re: Set background color for GD Lib imagerotate and imagecopy#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-12-09 08:50:01


Re: Set background color for GD Lib imagerotate and imagecopy#3
This comment is from the PHP documentation and credit goes to "weareexit at yahoo dot co dot uk""If you want to place an image on a larger canvas you've previously created with imagecreatetruecolor(), but you don't want the default black background to surround it: use imagefill() AFTER imagecopyresampled()."

posted date: 2008-12-09 09:08:00


Re: Set background color for GD Lib imagerotate and imagecopy#4
Thanks! I ended up doing an imagefill() from all 4 corners in order to "flood" the entire canvas.

posted date: 2008-12-09 10:12:00


select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.