Png transparency

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Cecile Muller

    Png transparency

    I've been trying to just open a png and display it, that way:

    <?
    header ("Content-type: image/png");
    $im = imagecreatefrom png('empty.png' );
    imagepng($im);
    ?>

    But the transparency is not kept. I did try in netscape too,
    but it's visible even in explorer, when comparing how the
    direct image looks and how it looks when thru the script, that
    transparency was killed.

    Ideas (on how to solve or at least which, from
    imagecreatefrom png or imagepng, kills the transparency) ?
    I got php 4.3.1 and the bundled GD of it.
  • Justin Koivisto

    #2
    Re: Png transparency

    Cecile Muller wrote:[color=blue]
    > I've been trying to just open a png and display it, that way:
    >
    > <?
    > header ("Content-type: image/png");
    > $im = imagecreatefrom png('empty.png' );
    > imagepng($im);
    > ?>
    >
    > But the transparency is not kept. I did try in netscape too,
    > but it's visible even in explorer, when comparing how the
    > direct image looks and how it looks when thru the script, that
    > transparency was killed.
    >
    > Ideas (on how to solve or at least which, from
    > imagecreatefrom png or imagepng, kills the transparency) ?
    > I got php 4.3.1 and the bundled GD of it.[/color]

    If it worked in Netscape, and not explorer, that's normal. However,
    there is a workaround you can use in the image tag:



    HTH

    --
    Justin Koivisto - spam@koivi.com
    PHP POSTERS: Please use comp.lang.php for PHP related questions,
    alt.php* groups are not recommended.

    Comment

    • Pat Scott

      #3
      Re: Png transparency

      I had the same problem. If you create the .png as a 'true color' graphic,
      it will not be transparent. When I created the same graphic using a '256
      color' palatte, transparency worked fine.

      Pat Scott
      "Cecile Muller" <spam@wildpeaks .com> wrote in message
      news:aff31ac6.0 308131736.7b1c0 e56@posting.goo gle.com...[color=blue]
      > I've been trying to just open a png and display it, that way:
      >
      > <?
      > header ("Content-type: image/png");
      > $im = imagecreatefrom png('empty.png' );
      > imagepng($im);
      > ?>
      >
      > But the transparency is not kept. I did try in netscape too,
      > but it's visible even in explorer, when comparing how the
      > direct image looks and how it looks when thru the script, that
      > transparency was killed.
      >
      > Ideas (on how to solve or at least which, from
      > imagecreatefrom png or imagepng, kills the transparency) ?
      > I got php 4.3.1 and the bundled GD of it.[/color]


      Comment

      Working...