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

Home » Public Forums » archive » Re: 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
Re: Tiff images with "short" Palette? [message #73864] Tue, 07 December 2010 14:21 Go to next message
Matt[2] is currently offline  Matt[2]
Messages: 69
Registered: March 2007
Member
> Yes, I think a "color vector" is 256 elements in length
> whether you fill 2 or 100 colors.

This is the crux. Can I make a "color vector" that has a length of 2
(or 3 or 5)?. If not, is that because of limitations with IDL, or
because of limitations to the TIFF spec. I've given the spec a
glance, and I can't see that the palette must be 256 colors.

> Hard to say if it is against the spec, I've never read it.
> But I don't think you are going to be able to make what you
> want in IDL. At least I don't know any way to.

Yup, so now I'm looking for alternatives.

> P.S. Hard to fault ArcView for loading the color table
> vectors. That's what I would do, too. :-(

No, that's exactly right, if your palette has 256 colors, load them
all. But I really don't want a palette with 256 colors.
Re: Tiff images with "short" Palette? [message #73865 is a reply to message #73864] Tue, 07 December 2010 12:32 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matt writes:

> The problem is that when someone opens my geotiffs in arcview, a whole
> black palette is displayed as 253 colors that aren't used. It's not
> just the return vector that looks like it has 255 elements in it, I
> believe the tiff file is stored with 255 when I've only asked it to
> store 2 values.

Zeros are more likely, don't you think? Especially
if things turn black on the other end.

Yes, I think a "color vector" is 256 elements in length
whether you fill 2 or 100 colors.

> Is this too much to ask for? Is it against the spec?

Hard to say if it is against the spec, I've never read it.
But I don't think you are going to be able to make what you
want in IDL. At least I don't know any way to.

Cheers,

David

P.S. Hard to fault ArcView for loading the color table
vectors. That's what I would do, too. :-(


--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Tiff images with "short" Palette? [message #73866 is a reply to message #73865] Tue, 07 December 2010 12:26 Go to previous messageGo to next message
Matt[2] is currently offline  Matt[2]
Messages: 69
Registered: March 2007
Member
> Yes, I think a 256 element vectors are stored as the color
> palette.
>
>> Does anyone know of a way to get around this problem?
>
> What problem are we talking about, exactly? The fact
> that the return vectors are 256 elements in length?
> Then just load the first two elements of these vectors
> in the color table.

The problem is that when someone opens my geotiffs in arcview, a whole
black palette is displayed as 253 colors that aren't used. It's not
just the return vector that looks like it has 255 elements in it, I
believe the tiff file is stored with 255 when I've only asked it to
store 2 values.


> Is that what you are looking for?

Nope, thanks. I'm looking for a way to have a tif palette that's
shorter than 255 elements.

Is this too much to ask for? Is it against the spec?

Matt
Re: Tiff images with "short" Palette? [message #73867 is a reply to message #73866] Tue, 07 December 2010 12:13 Go to previous messageGo to next message
David Fanning is currently offline  David Fanning
Messages: 11724
Registered: August 2001
Senior Member
Matt writes:

> 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.

Yes, I think a 256 element vectors are stored as the color
palette.

> Does anyone know of a way to get around this problem?

What problem are we talking about, exactly? The fact
that the return vectors are 256 elements in length?
Then just load the first two elements of these vectors
in the color table.

Is that what you are looking for?

Cheers,

David



--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
Re: Tiff images with "short" Palette? [message #73953 is a reply to message #73864] Wed, 08 December 2010 07:26 Go to previous message
jeanh is currently offline  jeanh
Messages: 79
Registered: November 2009
Member
On 07/12/2010 5:21 PM, Matt wrote:
>> Yes, I think a "color vector" is 256 elements in length
>> whether you fill 2 or 100 colors.
>
> This is the crux. Can I make a "color vector" that has a length of 2
> (or 3 or 5)?. If not, is that because of limitations with IDL, or
> because of limitations to the TIFF spec. I've given the spec a
> glance, and I can't see that the palette must be 256 colors.
>
>> Hard to say if it is against the spec, I've never read it.
>> But I don't think you are going to be able to make what you
>> want in IDL. At least I don't know any way to.
>
> Yup, so now I'm looking for alternatives.

Do you have Envi? ... maybe ENVI_WRITE_ENVI_FILE , with the fileType=
set to "tiff" value behaves differently... it specifically asks for a
lookup table, which is supposed to be 3*number of classes

Jean
Re: Tiff images with "short" Palette? [message #73959 is a reply to message #73864] Wed, 08 December 2010 05:35 Go to previous message
Bruce Bowler is currently offline  Bruce Bowler
Messages: 128
Registered: September 1998
Senior Member
On Tue, 07 Dec 2010 14:21:12 -0800, Matt set fingers to keyboard and
typed:

>> Yes, I think a "color vector" is 256 elements in length whether you
>> fill 2 or 100 colors.
>
> This is the crux. Can I make a "color vector" that has a length of 2
> (or 3 or 5)?. If not, is that because of limitations with IDL, or
> because of limitations to the TIFF spec. I've given the spec a glance,
> and I can't see that the palette must be 256 colors.
>
>> Hard to say if it is against the spec, I've never read it. But I don't
>> think you are going to be able to make what you want in IDL. At least I
>> don't know any way to.
>
> Yup, so now I'm looking for alternatives.
>
>> P.S. Hard to fault ArcView for loading the color table vectors. That's
>> what I would do, too. :-(
>
> No, that's exactly right, if your palette has 256 colors, load them all.
> But I really don't want a palette with 256 colors.

From a *quick* read of http://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 :-)

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

Bruce
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Tiff images with "short" Palette?
Next Topic: Saving Large(ish) PDF's with IMAGE() crashes IDL completely

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

Current Time: Wed Oct 08 13:52:53 PDT 2025

Total time taken to generate the page: 0.00691 seconds