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

Home » Public Forums » archive » Re: converting Png files to Double
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Re: converting Png files to Double [message #31684] Mon, 05 August 2002 15:05
thompson is currently offline  thompson
Messages: 584
Registered: August 1991
Senior Member
I was able to create a 16 bit PNG file in IDL, and then read it back in again,
with the following commands

IDL> a=dist(100)
% Compiled module: DIST.
IDL> a=32767.*a/max(a)
IDL> write_png,'test.png',uint(a)
% Loaded DLM: PNG.
IDL> b=read_png('test.png')
IDL> help,b
B UINT = Array[100, 100]
IDL> print,min(b),max(b)
0 32767

As far as I can tell, this is a valid PNG file--it displayed correctly in
Netscape.

William Thompson



"Rick Towler" <rtowler@u.washington.edu> writes:

> It would be helpful if you post a link to an example .png file.

> I am assuming you are working with a 16 bits per channel image? Photoshop
> isn't allowing me to write a 16 bit/channel .png so I can only use read_png
> with an 8 bit/channel image which returns a byte array.

> Or, are you combining two 8 bit channels to get your UINT value which you
> are trying to convert to double? If this is the case you need to convert at
> least one channel to UINT before multiplying.

> -Rick




> "ramji digumarthi" <ramji.digumarthi@lmco.com> wrote in message
> news:43689765.0208051003.c076e39@posting.google.com...
>> Hi folks,
>> I am currently working with BW PngFiles. I use READ_PNG command to
>> read the png file. Then I try to convert data into double precision
>> for some data analysis.
>> It is not working as I expected. The maximum value seem to be about 3
>> to 8?
>>
>> I see that READ_PNG is reading the file a UINT [Unsigned Integer: A
>> 16-bit unsigned integer ranging from 0 to 65535]. But when I convert
>> UINT to DOUBLE ,
>> I am getting only values in single digits???
>>
>> Can any one help on item?
>>
>> thank
>> Ramji Digumarthi
Re: converting Png files to Double [message #31692 is a reply to message #31684] Mon, 05 August 2002 12:09 Go to previous message
Rick Towler is currently offline  Rick Towler
Messages: 821
Registered: August 1998
Senior Member
It would be helpful if you post a link to an example .png file.

I am assuming you are working with a 16 bits per channel image? Photoshop
isn't allowing me to write a 16 bit/channel .png so I can only use read_png
with an 8 bit/channel image which returns a byte array.

Or, are you combining two 8 bit channels to get your UINT value which you
are trying to convert to double? If this is the case you need to convert at
least one channel to UINT before multiplying.

-Rick




"ramji digumarthi" <ramji.digumarthi@lmco.com> wrote in message
news:43689765.0208051003.c076e39@posting.google.com...
> Hi folks,
> I am currently working with BW PngFiles. I use READ_PNG command to
> read the png file. Then I try to convert data into double precision
> for some data analysis.
> It is not working as I expected. The maximum value seem to be about 3
> to 8?
>
> I see that READ_PNG is reading the file a UINT [Unsigned Integer: A
> 16-bit unsigned integer ranging from 0 to 65535]. But when I convert
> UINT to DOUBLE ,
> I am getting only values in single digits???
>
> Can any one help on item?
>
> thank
> Ramji Digumarthi
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Newbie: GUI builder
Next Topic: Re: /ALIAS and drawing in different draw_widgets

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

Current Time: Fri Oct 10 17:46:15 PDT 2025

Total time taken to generate the page: 1.11918 seconds