473,320 Members | 2,109 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Png transparency

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

<?
header ("Content-type: image/png");
$im = imagecreatefrompng('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
imagecreatefrompng or imagepng, kills the transparency) ?
I got php 4.3.1 and the bundled GD of it.
Jul 16 '05 #1
2 5640
Cecile Muller wrote:
I've been trying to just open a png and display it, that way:

<?
header ("Content-type: image/png");
$im = imagecreatefrompng('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
imagecreatefrompng or imagepng, kills the transparency) ?
I got php 4.3.1 and the bundled GD of it.


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

http://www.koivi.com/ie-png-transparency/

HTH

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

Jul 16 '05 #2
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" <sp**@wildpeaks.com> wrote in message
news:af**************************@posting.google.c om...
I've been trying to just open a png and display it, that way:

<?
header ("Content-type: image/png");
$im = imagecreatefrompng('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
imagecreatefrompng or imagepng, kills the transparency) ?
I got php 4.3.1 and the bundled GD of it.

Jul 16 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

57
by: Piotr Wolski | last post by:
how to make my page that it was correct with every browser standard? for example when i change HTML's table size it has no effect when i see it under mozilla and has effect under Internet...
4
by: Matthias Czapla | last post by:
Hi! I want to resize uploaded GIF images. Currently I do it like this: <?php // ... $img = imagecreatefromgif($path); $img_scaled = imagecreate($new_width, $new_height);...
2
by: Robin Becker | last post by:
Has anyone done transparency with PIL & TIFF? I'm using PIL to generate a preview TIFF for embedding into an eps file and am being asked for the TIFF to support transparency. -- Robin Becker
3
by: Mr. x | last post by:
Hello, I would like that my image's background color will be transparent. What I have is only paintbrush. My image is *.jpg format (I have tried to save it as *.gif format, and I got less...
20
by: Nathan Sokalski | last post by:
I am trying to create graphics with GDI+ that include transparency. However, the transparency never seems to show up, even though my colors have an alpha value of 0. How can I generate a graphic...
6
by: tommaso.gastaldi | last post by:
In a previous post I have been asking about a way to test Alpha Transparency. Bob and Michael have kindly provided some ideas. Here I would like to share the function I have prepared, for the...
0
by: ZikO | last post by:
Hi. I've experienced one problem. Im using three froms. Two of them are maximized, whereas one is normal form with transparency. Transparency stops working, that is I can see the color which...
1
by: dragze | last post by:
Hi, On one of the pages of my site i use two javascripts, one makes transparency of png's work in IE, and the other embeds a flash player. Now use one of the scripts it works fine, use both and...
3
by: Martijn Mulder | last post by:
When I populate a ToolStrip with ToolStripButtons with a .png-image on it, will Windows understand the transparency of the .png file?
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.