AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

1993.08.20 01:22 "help on TIFFReadRGBAImage", by Yip Chi Lap
1993.08.20 09:40 "Re: help on TIFFReadRGBAImage", by Karsten Spang
1993.08.21 01:08 "Re: help on TIFFReadRGBAImage", by Sam Leffler
1993.08.21 02:03 "Re: help on TIFFReadRGBAImage", by Yip Chi Lap
1993.08.22 18:02 "Re: help on TIFFReadRGBAImage", by Sam Leffler
1993.08.22 20:07 "Re: help on TIFFReadRGBAImage", by Sam Leffler
1993.08.23 08:07 "help on TIFFReadRGBAImage", by Oliver Trepte
1993.08.23 04:08 "Re: help on TIFFReadRGBAImage", by Yip Chi Lap
1993.08.23 10:58 "help on TIFFReadRGBAImage", by Oliver Trepte

1993.08.22 18:02 "Re: help on TIFFReadRGBAImage", by Sam Leffler

I suspect that you wrote the TIFF file with the default Orientation which is TopLeft. You don't indicate how you created the TIFF file. ppm2tiff looks to force all data to have a TopLeft origin.

Karsten Spang <krs@kampsax.dk> also asked how the TIFF file was generated.

I used ppm2tiff to convert the file and tiffinfo reports this:

TIFF Directory at offset 0x18
Image Width: 3 Image Length: 5
Bits/Sample: 8
Compression Scheme: Lempel-Ziv & Welch encoding
Photometric Interpretation: palette color (RGB from colormap)
FillOrder: msb-to-lsb
Document Name: "small.pnm"
Image Description: "converted PNM file"
Orientation: row 0 top, col 0 lhs
Samples/Pixel: 1
Rows/Strip: 2730
Planar Configuration: single image plane
Color Map: (present)

So the "(x,y)" in the sentence "Note that the raster is assume to be organized such that the pixel at location (x,y) is raster[y*width+x]" in the man page of TIFFReadRGBAImage refers to the 'normal' cartesian coordinates but not the (row,col) coordinate relative to the image, I suppose?

The Orientation tag specifies where the raster coordinate system origin is. The TIFF spec uses rows+columns and TIFFPrintDirectory mimics that terminology. You will either need to read the image rows in reverse order or change ppm2tiff to setup the origin to reflect your data. I don't know about ppm stuff; if it has origin information then it should propagate the information. Otherwise either the data must be organized correctly or you should add an option to ppm2tiff to set the origin to reflect the data.

I have been informed by others that ppm2tiff is weak and should be dropped from the distribution. I include it mostly because I find it useful (it saves me from dealing with the entire ppm distribution) and because it serves as an example use of the library.

Sam