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 #68440] Sun, 25 October 2009 09:32 Go to previous message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Greg writes:

> That looks like a colour profile problem. I think your original is
> sRGB, and IDL is probably ignoring that and rewriting without
> specifying a profile. I'm not sure why Photoshop displays them the
> same - I'd expect it to handle the profile properly - but perhaps it's
> not common to have a profile in a 4-channel png.

Well, the problem turned out NOT to be a color profile
problem, thank goodness. But it was a metadata problem.
Thanks to someone who knows about these things for pointing
this out to me in a private e-mail.

I have learned quite a lot more about PNG files in the
past couple of days than I had planned to learn. :-)

First of all, it is possible to include all kinds of
metadata in PNG files. I've also learned that this
metadata is almost completely non-standard, so that is
is *extremely* difficult, if not impossible, to write
a PNG file reader that can preserve the metadata. The
IDL PNG reader, as you might imagine, does not even
try. (This is what I would do, too, if I were writing
a PNG reader.)

The example.png file that I downloaded from the Internet
contains a gAMA metadata tag. This tag indicates the "gamma"
value that should be used in transferring the image data
to the display. My Firefox and Internet Explorer browsers
read that data and do the transfer correctly.

The test.png file I created in IDL from the example.png file
does not include this gAMA tag in the test.png file. It does,
however, write the image data correctly. Thus, my browsers
render this file in darker colors than the previous file, since
there is no gamma correction being made.

To be certain this was the explanation. I downloaded a program
named TweakPNG that allowed me to examine the metadata chucks
in these PNG files.

http://entropymine.com/jason/tweakpng/

I exported the gAMA chunk from example.png and then imported that
chunk into test.png. Low and behold, the test.png file now renders
*exactly* like example.png in my browser!

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: Wed Oct 08 13:43:36 PDT 2025

Total time taken to generate the page: 0.00397 seconds