473,785 Members | 2,618 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.
Jul 16 '05 #1
2 5661
Cecile Muller wrote:
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.


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.goo gle.com...
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.

Jul 16 '05 #3

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

Similar topics

57
4030
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 explorer-does anyone know how to solve that problem??
4
3314
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); imagecopyresampled($img_scaled, $img, 0, 0, 0, 0, $new_width, $new_height, $old_width, $old_height);
2
4881
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
3872
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 quality), and I don't know how to make the background. In every tool I open the image (html, flash, etc...) I see the original background color, and not the transparent color.
20
4525
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 that is completely transparent in certain areas (so that the web page background shows through)? I save my graphics as gif files. I would appreciate, if possible, a simple example so that I can see the code. Thanks. -- Nathan Sokalski...
6
3655
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 purpose to improve it. Frankly, I am not clear about the exact meaning of some pixel format (max, gdi, etc.) and I hope I have put them under the right "case". I have made only some superficial test and it seems to work. Note that the purpose is...
0
1313
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 should be the transparency. It is happaning always when I go to second maximized form, use comboBox and come back closing second form to first from and use third form with transparency. Then transparency stops working. Strange!
1
2726
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 the transparency script stops working. So for example, use just the png transparency script and it displays the png's correctly in IE, as soon as i add the SWFobject (flash embedding) script the transparency script stops working!!?? :S Any help...
3
4229
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
9645
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9481
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10341
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9954
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8979
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6741
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5383
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
3656
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2881
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.