Can I create an image with a specific level of transparency?

K

Kurda Yon

Hi,

to make a part of an image transparent I use the following commands:
imagecolortransparent($image, $color_1);

After that command all parts of an image, which are "colored" by
$color_1, will be transparent. It means that If I put such an image as
a table-background, I will see the page-background behind the
transparent parts of the image.

However, in the above way, I can create only absolutely transparent
"colors" and I would like to have "partially" transparent colors. I
tried to use

$color_1 = imagecolorallocatealpha($image, 255, 0, 0, 60);

In theory it should create the red color with the level of
transparancy equal to 60. However, because of some reasons, it does
not work. I cannot see anything through this red color. Or to be more
precise, I can see some objects through this color ONLY if these
objects are part of the image. But image itself is not transparent.

Does anybody know how to overcome this problem and why it appears?

Thank you in advance.
 
C

cwdjrxyz

Hi,

to make a part of an image transparent I use the following commands:
imagecolortransparent($image, $color_1);

After that command all parts of an image, which are "colored" by
$color_1, will be transparent. It means that If I put such an image as
a table-background, I will see the page-background behind the
transparent parts of the image.

However, in the above way, I can create only absolutely transparent
"colors" and I would like to have "partially" transparent colors. I
tried to use

$color_1 = imagecolorallocatealpha($image, 255, 0, 0, 60);

In theory it should create the red color with the level of
transparancy equal to 60. However, because of some reasons, it does
not work. I cannot see anything through this red color. Or to be more
precise, I can see some objects through this color ONLY if these
objects are part of the image. But image itself is not transparent.

Does anybody know how to overcome this problem and why it appears?

You can create a png with transparency, and, I think, some types of
partial transparency, using server side php with the gd extension. I
have made one color completely transparent, but I have not tried
partial transparency using gd. Either you can use a php include in
your code to do this, or you can generate and save an actual png to
download and store on your computer and used as usual for an image on
web pages..
 
K

Kurda Yon

You can create a png with transparency, and, I think, some types of
partial transparency, using server side php with the gd extension. I
have made one color completely transparent, but I have not tried
partial transparency using gd. Either you can use a php include in
your code to do this, or you can generate and save an actual png to
download and store on your computer and used as usual for an image on
web pages..

I use dg and I was able to create completely transparent image. But I
have problems with partially transparent image. I could create a
partial transparent objects (for example ellipses), such that I could
see other objects trough them. But the whole image itself is not
transparent...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top