Newsgroups: sci.image.processing
Path: cantaloupe.srv.cs.cmu.edu!das-news2.harvard.edu!news2.near.net!news.mathworks.com!newshost.marcam.com!zip.eecs.umich.edu!caen!math.ohio-state.edu!howland.reston.ans.net!ix.netcom.com!netcom.com!olea
From: olea@netcom.com (Michael Olea)
Subject: Re: THe 'libtiff' library & Intel TIFF support
Message-ID: <oleaD4J9yC.8Bw@netcom.com>
Organization: NETCOM On-line Communication Services (408 261-4700 guest)
References: <oleaD4H5M2.F69@netcom.com> <sbrogden.30.000C21FB@derwent.co.uk> <331159955wnr@dstrip.demon.co.uk> <377583093wnr@dstrip.demon.co.uk>
Date: Sat, 25 Feb 1995 02:08:36 GMT
Lines: 37
Sender: olea@netcom10.netcom.com

Steve@dstrip.demon.co.uk (Steve Rencontre) writes:

>In article: <oleaD4H5M2.F69@netcom.com>  olea@netcom.com (Michael Olea) writes:
>> 
>> Steve@dstrip.demon.co.uk (Steve Rencontre) writes:
>> >...you don't have to *understand* any of the TIFF tags, just swap 
>> >bytes around.

>> 	Swapping bytes in the tags is in general not sufficient.
>> For example, the "stripOffsets" and "stripByteCounts" tags may point
>> to data that would also need to be swapped to be consistent - or
>> they may point to data that should be left alone.

>I didn't mean (or say, IMO) that you should only swap bytes in the tags. 

>> A program cannot
>> distinguish such cases without *understanding* at least some of the
>> tags.

>No, the program must understand the TIFF rules, which say that a tag 
>may *contain* or *point to* data, but in all cases, the format of the data 
>(byte, word, longword, etc) is defined by the tag. However, the 
>meaning of the data is irrelevant. I can define my own tag called 
>privateNumberOfElephantsInScene and if I follow the rules, somebody 
>else should be able to byte-swap my data correctly.


  This is almost true.  Consider, though, a single-strip greyscale image
(one sample per pixel) with 16 bits per sample.  The stripOffset tag
"contains" the offset, so it can be swapped and it will continue to
point correctly to the strip.  But in this case the image data itself
has to be byte-swapped.  No generic rule about tag structure and syntax
provides this information.  You need to deduce this from bitsPerSample.
But bitsPerSample is not enough - the image data might be compressed.
So perhaps the post processor would need to decompresse the image, byte-swap
it, and recompress it.  I don't think you can deduce that from the rules
that tell you if a tag contains or points to its values.
