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

Discussion in 'HTML' started by Kurda Yon, Oct 11, 2008.

  1. Kurda Yon

    Kurda Yon Guest

    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.
     
    Kurda Yon, Oct 11, 2008
    #1
    1. Advertising

  2. Kurda Yon

    cwdjrxyz Guest

    On Oct 11, 11:54 am, Kurda Yon <> wrote:
    > 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..
     
    cwdjrxyz, Oct 11, 2008
    #2
    1. Advertising

  3. Kurda Yon

    Kurda Yon Guest

    On Oct 11, 4:05 pm, cwdjrxyz <> wrote:
    > On Oct 11, 11:54 am, Kurda Yon <> wrote:
    >
    >
    >
    > > 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..


    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...
     
    Kurda Yon, Oct 12, 2008
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. VB Programmer

    Image transparency

    VB Programmer, Jun 10, 2004, in forum: ASP .Net
    Replies:
    4
    Views:
    412
    VB Programmer
    Jun 10, 2004
  2. Jeremy Deats'
    Replies:
    8
    Views:
    1,230
    DigiAl
    Jul 5, 2004
  3. azsx
    Replies:
    2
    Views:
    1,135
  4. pabbu
    Replies:
    8
    Views:
    772
    Marc Boyer
    Nov 7, 2005
  5. manjula
    Replies:
    1
    Views:
    1,462
    Roedy Green
    Oct 30, 2007
Loading...

Share This Page