IDL> pg=read_png('/home/hcp/wrk/idlcourse/colourpeng.png',r,g,b) %%IDL> pg=rotate(pg,7) ; wont be needed after upgrade IDL> tvlct,r,g,b IDL> showimage,pg,win=2
Remember that on 24-bit displays, you will need to do:
IDL> device,true_color=24,decomposed=0,retain=2for this to work.
The ppm file format stores 24 bit images. Here is how to read in a ppm file, we use the help command to see what the resulting array is like:
IDL> read_ppm,'/home/hcp/wrk/idlcourse/ferry.ppm',ferry IDL> help,ferry FERRY BYTE = Array[3, 593, 413]This is an 593 X 413 pixel image containing three 'layers', red, green and blue.
We can do this to see the individual layers:
IDL> loadct,0 IDL> showimage,reform(ferry[2,*,*]),win=2 IDL> showimage,reform(ferry[1,*,*]),win=1 IDL> showimage,reform(ferry[0,*,*]),win=0
Note that the boat in the centre foreground looks dark in the red and green images but light in the blue image. To display this as a colour image on a 24-bit terminal, you just need to use the /true keyword with tv:
IDL> tv,ferry,/true