Tiff images with "short" Palette? [message #73868] |
Tue, 07 December 2010 11:50  |
Matt[2]
Messages: 69 Registered: March 2007
|
Member |
|
|
So I'm really creating these great geotiffs in IDL, but I'm having
problems with the palettes that are attached.
I think I've boiled my problem down to the way I'm making my tif
files. For the sake of argument, I am creating the tif with a 2
element color palette, but IDL appears to be creating a 255 color
palette in the background and storing a bunch of information that I
don't want. Here's some sample code of exactly what I'm doing.
Does anyone know of a way to get around this problem?
pro geotiff_problem
compile_opt idl2, logical_predicate
device, decomposed = 0
;; Load a rainbow.
loadct, 34
;; Set 0 and 1 to black and white
red = [ 0, 255 ]
green = [ 0, 255 ]
blue = [ 0, 255 ]
tvlct, red, green, blue
file = FILEPATH( SUBDIR = [ 'examples', 'data' ], 'worldelv.dat' )
data = BYTARR( 360, 360 )
OPENR, lun, file, /GET_LUN
READU, lun, data
FREE_LUN, lun
;; create a mask of 0/1 of rough outlines of coasts.
mask = (data gt 126)
;; Write a tif with 2 colors.
write_tiff, 'sample.tif', mask, red = red, $
green = green, blue = blue
;; Read a tif of 255 colors
tif = read_tiff( 'sample.tif', red_out, blue_out, green_out )
help, red_out
end
|
|
|