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 <firstname.lastname@example.org> 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
Compression Scheme: Lempel-Ziv & Welch encoding
Photometric Interpretation: palette color (RGB from colormap)
Document Name: "small.pnm"
Image Description: "converted PNM file"
Orientation: row 0 top, col 0 lhs
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.