Jump to content

Changing an image's opacity


Danke

Recommended Posts

I'm having a bit of trouble figuring out a step of a script I'm trying to write. I'm trying to make an image overlapping script that makes a full opacity jpg image 50% transparent and overlays it on another image so that they both show. This is how I envision the script:

 

1. User inputs URLs for image1 and image2 (same size jpgs) into textboxes and hits 'submit'.

 

2. Script takes image1 and sets the entire image opacity to 50%.

 

3. Image1 is overlaid over image2 so image2 shows through partly.

 

4. Script spits out the resulting overlaid image on the next page.

 

I'm having trouble finding a function for step 2 that will change the opacity of image1. I can't change the images into transparent pngs beforehand, since they are coming off the Internet and are already saved as jpgs. I've looked through the GD Library functions, but I can't seem to find something that will do the trick--does anyone have any suggestions?

Link to comment
Share on other sites

Oh, thank you, mgallforever! I had seen that function, but I thought it only affected pictures that already had transparency for some reason. Let me see how it works.

 

Envexlabs, thanks so much for the tip--that's a really easy and simple way to do it, come to think of it. But I need to be able to save the combined image so I don't think that method would work for me.

Link to comment
Share on other sites

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.