Contents || Index
06/11/2004

If a TIFF (or any other image file) has image data that is contiguous and somewhere within the file, and you know the image dimensions and pixel data type, you can import the image into Lispix easily.

Case 1:     TIFF file with incorrect header.  Image data not at the end of the file.

Suppose the image is 256x256x8 bit.  The actual, unscaled pixel values are what you want.  What is unknown is the offset to the image data, i.e., the length of the header.

(If the image size or data length is not known, but the header is intact, the information can be had by using File / File Utilities Tool / TIFF / Header info'.  Sometimes the header is written properly, but information regarding photometric interpretation or samples per pixel, or some other thing is not correct, making theimage data to be read improperly.)

1)    'TOOLS / import', and set the parameters thus:

<note 1> Most 8 bit images are unsigned - 0 - 256.  Some integer images are signed.  Vary rarely I've seen signed 8 bit data, with values -128 - 127.

<note 2> Byte order can either be little-endian (PC - Intel) or big-endian (Mac - Motorola).  With only one byte, the order does not matter and this parameter is ignored.

<note 3> Recorded-by can be either image or spectrum.  This parameter is only used when there is more than one image in the file, or the pixels have more than one value.  Not the case here.

2)    File / Import/Export Tool / 'i/o / import from file'

      Change the file dialog file type to 'All files (*.*)' in order to see the files with the .tif extension. The image window should show part of the image (wrapped around) and some nonsense at the top, which represents the header.

3)    'View / small titles off'     Use if the small titles cover the header. If the header information is all that is seen on a black field, try to enhance the contrast using 'Palette / contrast slider' or another slider.  The image wrap should be obvious. The position of the end of the header should give the offset, or the beginning of the image might be obvious.  If not, find the right offset using trial and error.

 

Case 2:     TIFF file with incorrect header.  Image data at the end of the file.

Sometimes this is the case.  The offset can be determined by subtracting the size of the image data from the size of the file.

Image file size: 67228  <note 1>

256 * 256:        65536  (image height x width)

difference        1692  <note 2>

<note 1>    Right click on file, 'properties', read or cut Size value.  Do not use the Size On Disk value.  You need the actual number of bytes in the file, not how much disk space is used, which will be greaterbecause disk space is assigned to files by blocks of varing size, depending on the operating system.

<note 2>    You can use the command line feature of Lispix to calculate this: 

Use 1692 as the offset and the image reads in directly.