Jump to content

Recommended Posts

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.  ;D

 

Fred

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.