Re: Q: raw data conversion [message #2768] |
Tue, 20 September 1994 10:04  |
8015
Messages: 52 Registered: November 1993
|
Member |
|
|
In article <1994Sep19.110600.24425@msuvx1.memphis.edu>,
PAVAN VEMULAKONDA <pvemulakonda@cc.memphis.edu> wrote:
> I have some image data files with plain integer values of the pixel intensity.
> I want to convert them into any of the following formats tiff,gif,jpeg etc.
> How can I do that. How can I read the raw integer data as an image data in IDL.
> Plz help me with this problem.
>
> thanks
I assume you know the size of the file in X,Y dimensions. Let's say the
file is 1024(X) x 768(Y). The commands should be:
IDL> ifile = "name of your input file" ; input integer file
IDL> ofile = "name of your output file" ; output gif file
IDL> image = intarr(1024, 768) ; create array for storing data
IDL> openr, lun, ifile, /get_lun ; open the input file
IDL> readu, lun, image ; read the input file into the data array
IDL> free_lun, lun ; free the file lun
IDL> write_gif, ofile, bytscl(image) ; not sure if bytscl() is needed
For tiff files, sub tiff_write for write_gif. For jpeg, sub write_jpeg
for write_gif. Look in the "data_io" and "routines" categories in the
help section for other formats.
Mike Schienle Hughes Santa Barbara Research Center
8015@sbsun0010.sbrc.hac.com 75 Coromar Drive, M/S B28/87
Voice: (805)562-7466 Fax: (805)562-7881 Goleta, CA 93117
|
|
|