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
https://forums.phpfreaks.com/topic/62098-changing-an-images-opacity/
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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.