From: warmerdam@pobox.com (Frank Warmerdam)
Date: Sat, 02 Aug 2003 21:52:15 -0400
Subject: [Tiff] problems using tiffwritetile
In-Reply-To: <0bbb01c35867$cf0fc9a0$320d1282@ercwin.erc.msstate.edu>
References: <0bbb01c35867$cf0fc9a0$320d1282@ercwin.erc.msstate.edu>
Message-ID: <3F2C6ACF.3040408@pobox.com>

Pushkar Pradhan wrote:
> I'm not able to write a tiled tiff file. The problem is TIFFWriteTile is 
> not writing the amount of data being read by TIFFReadTile
> TIFFReadTile reads in 16384 bytes but TIFFWriteTile writes out only 2048 
> bytes.
> Can anyone tell what's going wrong? (it's a single band img. and I set 
> the tags also).
>  
> Code:
>     for(y = 0; y < imageLength; y += tileLength) {
>       for(x = 0; x < imageWidth; x += tileWidth) {
>         size = TIFFReadTile(tif, buf, x, y, 0, 0);
>         printf("read %d bytes\n", size);
>         count++;
>         printf("tile: %d\n", count);
>         /* RGBTOLHS */
>         /*Rgb2Lhs(&bufR, &bufG, &bufB, &L, &H, &S, tileLength, tileWidth);*/
>         size = TIFFWriteTile(wtif, buf, x, y, 0, 0);
>         printf("written %d bytes\n", size);
>         printf("width %d bytes\n", x);
>         printf("length %d bytes\n", y      }
>     }
>  
>  
> Pushkar Pradhan

Pushkar,

I think we would need to see more of your program to know what is going
wrong.  It seems likely that the configuration of the output file is different
from the input file.  For instance, number of samples per pixel, bits per
sample, or planar configuration.  These would all result in writing a
different amount of data than was read.

Best regards,

-- 
---------------------------------------+--------------------------------------
I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam
and watch the world go round - Rush    | Geospatial Programmer for Rent



