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

Home » Public Forums » archive » Re: How can I display a PNG file??
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: How can I display a PNG file?? [message #23144] Wed, 10 January 2001 07:18
davidf is currently offline  davidf
Messages: 2866
Registered: September 1996
Senior Member
Miguel Angel Cordoba (cordoba@ehma.upc.es) writes:

> i am using the query_png and the read_png functions to read a png file.
> The read_png returns a 4 channel image and i don't know how to display
> it.
> I execute this commands:
>
> IDL> ok=query_png('intro.png',s)
> % Loaded DLM: PNG.
> IDL> help,s,/structure
> ** Structure <780f0>, 7 tags, length=36, refs=1:
> CHANNELS LONG 4
> DIMENSIONS LONG Array[2]
> HAS_PALETTE INT 0
> IMAGE_INDEX LONG 0
> NUM_IMAGES LONG 1
> PIXEL_TYPE INT 1
> TYPE STRING 'PNG'
> IDL> window,0
> IDL> wset,0
> IDL> image1=read_png('intro.png')
> IDL> tv,image1
> IDL> help,image1
> IMAGE1 BYTE = Array[4, 629, 288]

This image is a 24-bit RGB image, with an additional
alpha channel that can be used for blending images
together (and other things). To display a 4-channel
image correctly, you are going to have to use the
object graphics system in IDL. (Beyond the scope
of this discussion.)

But to see the image in the normal direct graphics
system, all you have to do is extract the RGB
channels, like this:

imageRGB = image1[0:2, *,*]

Then, you would display the image normally:

Device, Decomposed=1
TV, imageRGB, True=1

Or, if you don't want to mess around with the Decomposed
stuff and the True keyword, you can use the TVIMAGE command
from my web page:

TVImage, imageRGB

Cheers,

David
--
David Fanning, Ph.D.
Fanning Software Consulting
Phone: 970-221-0438 E-Mail: davidf@dfanning.com
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Toll-Free IDL Book Orders: 1-888-461-0155
[Message index]
 
Read Message
Previous Topic: How can I display a PNG file??
Next Topic: Newbie needs help...

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

Current Time: Sat Oct 11 16:06:15 PDT 2025

Total time taken to generate the page: 0.15856 seconds