comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Tiff images with "short" Palette?
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Switch to threaded view of this topic Create a new topic Submit Reply
Tiff images with "short" Palette? [message #73868] Tue, 07 December 2010 11:50 Go to next message
Matt[2] is currently offline  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
Re: Tiff images with "short" Palette? [message #73955 is a reply to message #73868] Wed, 08 December 2010 07:03 Go to previous message
Matt[2] is currently offline  Matt[2]
Messages: 69
Registered: March 2007
Member
> From a *quick* read ofhttp://partners.adobe.com/public/developer/en/tiff/
> TIFF6.pdf, it would appear that it's more a limitation of IDL, and
> depending on which section of the spec you read it might be partially a
> limitation of the spec, which at one point defines the size of the color
> table as 3*2^BitsPerSample (seems to say you can have whatever size table
> you'd like), but in another section (specifically talking about grey scale
> images) says that BitsPerSample can either be 4 or 8 and somewhere says
> that the default for BitsPerSample is 1 (which is neither 4 nor 8 :-)

You found the same parts of the spec that I did.

> At this point, I'd point the "flying fickle finger of fault" mostly in the
> direction of IDL.

And came to the same conclusion that I did also. I put in a support
request. Let's see what happens.

Thanks everyone.

Matt
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Re: Stupid question regarding BUFFER keyword in NG output.....
Next Topic: Re: Tiff images with "short" Palette?

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Wed Oct 08 19:21:43 PDT 2025

Total time taken to generate the page: 0.00498 seconds