MathGroup Archive 1999

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Importing 16-bit TIFF files with 4.0

On 6 Oct 1999, Beth Sornsin wrote:

> I've been trying to import some 16-bit grayscale TIFF files into
> Mathematica 4.0 with no success. The files were created by a
> commercial imaging program -- the progam says it produces TIFF v6.0.

If you refer to the canonical TIFF revision 6 specification at Adobe's

Section 4 of this document states that the BitsPerSample tag for grayscale
images can take on only two values -- 4 and 8 -- meaning that only 4 bit
(16 shades of gray) and 8 bit (256 shades of gray) are supported by the
baseline standard.  You image manipulation software is most likely using a
non-standard extension tag which is not recognized by the TIFF libraries
that Mathematica relies on.

> I need to extract the numerical intensity values from 
> the TIFF files in order to manipulate them in Mathematica,
> so it's not just a matter of displaying the graphics
> (which doesn't work either!). I've been able to import
> the 8-bit TIFF files just fine.
> What I need is:
> (1) a way of directly importing the 16-bit TIFF's
>     into Mathematica 4.0, or
> (2) a quick method of converting the 16-bit TIFF's
>     into a format that Mathematica 4.0 will read.

I don't know if there is a quick method to do this.  I have been able to
find commercial developer toolkits and applications which claim support
for 16-bit TIFFs, but it is hard to say whether these formats are
compatible with one another since there is (to the best of my knowledge)
no published standard for the tag or the storage of the data in the file.  
If you can find a tool that is capable of parsing the TIFF file's data,
you way want to have it write the raster contained in the TIFF as a binary
file containing 16-bit integers.


dataArray = BinaryImport["imagedata.dat", {"Integer16"..}]

Make sure that you know what byte ordering is being used by the tool
because you may need to adjust this with the ByteOrdering option (1 for
big-endian, -1 for little endian).

P.J. Hinton
Mathematica Programming Group           paulh at
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.

  • Prev by Date: Re: Re: List-Selection
  • Next by Date: Re: Why Doesn't N[Pi,i] Give i Digits For Small i, Mathematica
  • Previous by thread: Re: Importing 16-bit TIFF files with 4.0
  • Next by thread: Help Needed: How to use a Notebook from an external Program via Mathlink?