[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: using TVRD on idl 5.1



Peliz wrote:

> I need a color output to a .ppm file on my system (solaris 2.5 & IDL
> 5.1). The way I am trying (and I think it works on a PC)
> is to use the output of tvrd(/true). But it is not working...
> If I use,
> x = tvrd(/true)
> tv, x, /true
> shouldn't I get the same window?
> Even if my x look a little strange (half good half kind of
> noisy) how comes the result in the .ppm is a repeated pattern (~3x)?!
> the remarks under"
> Unexpected Results Using TVRD with X Windows" of the idl help
> did not solve the problem!
>
> As anyone trayed this? (not on a PC not to a GIF)
> thanks a lot,
>
>

Hello,

It is unfortunate that you want to use a the PPM format, otherwise you
could use Liam's SAVEIMAGE routine (see posting below regarding sving
GIF format images.)    You will get strange results (as you described)
when you specify /TRUE for TVRD when you have an 8bit display.

Try the following....

  ;get the image
X = TVRD()
  ;get the color vectors
TVLCT, Red,Green,Blue, /Get
  ;make a 24 bit array
Sz = Size(X,/Dim)
Img = BytArr(3,SZ[0],Sz[1])
  ;assign each of the red, green, blue values of each pixel
Img[0,*,*] = Red[X[*,*]]
Img[1,*,*] = Green[X[*,*]]
Img[2,*,*] = Blue[X[*,*]]
 ;write the image
Write_PPM, FileName, Img



Ben

--
Ben Tupper

Bigelow Laboratory for Ocean Science
tupper@seadas.bigelow.org

pemaquidriver@tidewater.net