Writing out TIFF files [message #5694] |
Wed, 24 January 1996 00:00 |
Sangeet Singh
Messages: 4 Registered: January 1996
|
Junior Member |
|
|
I would like to write out some image arrays in IDL as .tif files. So
far I have been able to do this *only* by doing a TVSCL of the image
followed by a TVRD into a BYTARR which is written using TIFF_WRITE.
I'd like to be able to use TIFF_WRITE with my image array without
having to go through TVSCL and TVRD each time. The approach suggested
in the on-line help yields a .tif file containing only random noise.
Below I've including portions of my code with comments. I'd appreciate any
suggestions or even stories of people's experiences with TIFF_WRITE.
I'm running IDL 4.0 on sunos sparc but have had the similar results with
older IDL versions on various UNIX systems.
Thanks.
--Sangeet
img1 = intarr(col,row)
img2 = intarr(col,row)
img3 = intarr(col,row)
tifimg = bytarr(col,row)
; This creates a new array img2 from the original array img1.
; img2 has the row order reversed w.r.t. img1.
; So img1 is upside down and img2 is right side up (for ORDER=0).
;
;
img2=REVERSE(img1,2)
; The following tvscl results in the image being displayed upside down
; on the screen. However, the tiff file *as read by Photo Styler*
; ends up being right side up when written with an orientation of 1
; after a tvrd. (an orientation of 0 is probably ok too)
;
tvscl,img2,ex,why,ORDER=1
tifimg=tvrd(ex,why,col,row)
TIFF_WRITE,filename5,tifimg,1
; The following results in a tiff file containing only random noise, not
; the real image.
;
;tifimg=img2
;OR
;tifimg=BYTE(img2)
;
;TIFF_WRITE,filename5,tifimg,1
; I use the following to read back the tiff file to verify if it contains
; the image. This image is upside down, even though the .tif file appears
; right side up when read by other programs, as said earlier.
;
img3=TIFF_READ(filename5)
tvscl,img3
|
|
|