comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Creating Transparent PNG Images
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Creating Transparent PNG Images [message #68442 is a reply to message #68441] Sat, 24 October 2009 09:01 Go to previous messageGo to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
David Fanning writes:

>
> Devin White writes:
>
>> You can write out transparent 24-bit PNGs by supplying a 4-channel
>> array to WRITE_PNG (4 x samples x lines). The first three channels
>> are RGB, the fourth is the alpha channel. Fully visible pixels should
>> have their corresponding alpha channel elements set to 255,
>> transparent pixels should have theirs set to 0.
>
> OK, well, then the documentation REALLY needs to be improved!
>
> But there is still a problem. Consider the transparent PNG
> image you find here:
>
> http://www.dfanning.com/ip_tips/example.png
>
> I tried this:
>
> IDL> image = read_png('example.png')
> IDL> help, image
> IMAGE BYTE = Array[4, 162, 150]
> IDL> write_png, 'test.png', image
>
> Then, I opened both example.png and test.png in my
> browser (FireFox). They appear to be two different
> images! The test.png file appears in MUCH darker colors.
>
> Any ideas on what this could be about?

The mystery deepens. When I look at these two images in
Photoshop, they appear to be identical, and look much more
like the image I created in IDL then the image I downloaded
from the Internet. And yet, the *data* in the two images
appears to be identical:

IDL> image = read_png('example.png')
IDL> img = read_png('test.png')
IDL> Print, Total(image - img)
0.000000

Even Internet Explorer displays the two images differently.

Very strange. :-(

Cheers,

David

--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Wow! Value_Locate
Next Topic: For loop

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sat Oct 11 01:58:37 PDT 2025

Total time taken to generate the page: 1.76059 seconds