AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2006.07.21 12:40 "[Tiff] How to save in tiff format file?", by Toh kc
2006.07.21 17:16 "RE: [Tiff] How to save a tiff format file?", by
2006.07.25 11:45 "Re: [Tiff] How to save in tiff format file?", by Gerben Vos
2006.07.25 13:41 "RE: [Tiff] How to save in tiff format file?", by
2006.07.30 10:36 "Re: [Tiff] How to save in tiff format file?", by Toh kc
2006.07.31 13:39 "RE: [Tiff] How to save in tiff format file?", by
2006.08.02 02:09 "RE: [Tiff] How to save in tiff format file?", by Toh kc
2006.08.02 10:14 "Re: [Tiff] How to save in tiff format file?", by Gerben Vos
2006.08.02 17:27 "RE: [Tiff] How to save in tiff format file?", by
2006.08.16 02:05 "[Tiff] Re: How to save in tiff format file?", by Toh kc
2006.08.24 13:38 "Re: [Tiff] Re: How to save in tiff format file?", by Gerben Vos
2006.08.24 14:56 "Re: [Tiff] Re: How to save in tiff format file?", by Toh kc

2006.08.02 17:27 "RE: [Tiff] How to save in tiff format file?", by

Toh wrote:

for (int i = 0; i < Gheight; i++)
   for(int j = 0; j < Gwidth; j++)

        sImg[i * Gwidth + j] = (unsigned char)(j * i);

Perhaps try something a little more "visually obvious", like:

memset(sImg, 0, Gheight * Gwidth); // clear to black (photometric == min-is-black)

int iMax = min(Gheight, Gwidth);
for (int i = 0; i < iMax; ++i)
        sImg[i * Gwidth + i] = 255; // diagonal line of white

Now, if the line is distorted, the "way" in which it is distorted may help you figure out where the problem lies. For example, with the original indexing error ("TIFFWriteScanline(dif, &array[k], k);"), instead of the start of each scanline, a pointer to the next pixel of the first scanline is passed. This results in a vertical line if you've set up your array as I described.

You could also try gradients (e.g. each pixel in a line containing the same pixel colour, but each line using an incrementing colour), corners, etc.

If you've reached the point where theoretically everything is correct (i.e. you've stepped through the code in your imagination, picturing each stage, etc), and it's *still* misbehaving, send me as much of the complete routine as you are able, and I'll take a look at it when I get a chance. Or maybe you have some co-workers or nearby friends who could look at it; often a fresh pair of eyes is all that's needed to catch a minor mistake with major effects.