fwilson789 Posted June 18, 2009 Share Posted June 18, 2009 This is a really weird problem. So I start out by making the images: $image = imagecreatefromjpeg("background.jpg"); // make background image from jpeg $rectangle = imagecreatetruecolor(1000, 98); // make rectangle that will be semi-opaque (imagecopymerge) $text = imagecreatetruecolor(1000, 98); // make text that should be on top of rectangle w/ transparent background Whenever you use the imagecreatetruecolor() function, the resulting image has all black pixels for the background. To fix this, I just draw a rectangle over the entire created image and set the color to red. Following this, I call imagecopymerge($image, $rectangle,..., 50) This works wonderfully as I have a red rectangle on top of my main image that is 50% see-through. The reason I want my text on a different image is so that it can be moved independently of the rectangle, and go out of it if necessary. I would also like the text to have a 75% opacity. The problem here is that I can't seem to make the background of the $text image transparent without it looking terrible. I allocated $black to black and used imagecolortransparent(). It worked, but there is a small black border around the text. I know this may not be the most clear question in the world, but I had to write it quick. I appreciate anyone's help very much. Fred Quote Link to comment https://forums.phpfreaks.com/topic/162787-php-imagecreatetruecolor-black-background/ Share on other sites More sharing options...
RussellReal Posted June 18, 2009 Share Posted June 18, 2009 the first color you assign to your image is used as the background color.. Quote Link to comment https://forums.phpfreaks.com/topic/162787-php-imagecreatetruecolor-black-background/#findComment-859038 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.