From: pushkar@GRI.MsState.Edu (Pushkar Pradhan)
Date: Fri, 1 Aug 2003 15:02:17 -0500
Subject: [Tiff] problems using tiffwritetile
Message-ID: <0bbb01c35867$cf0fc9a0$320d1282@ercwin.erc.msstate.edu>
Content-Type: multipart/alternative;
     boundary="----=_NextPart_000_0BB8_01C3583D.E61D38F0"

This is a multi-part message in MIME format.

------=_NextPart_000_0BB8_01C3583D.E61D38F0
Content-Type: text/plain;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

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 =3D 0; y < imageLength; y +=3D tileLength) {
      for(x =3D 0; x < imageWidth; x +=3D tileWidth) {
        size =3D 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 =3D 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

------=_NextPart_000_0BB8_01C3583D.E61D38F0
Content-Type: text/html;
	charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.3502.5390" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT face=3DArial size=3D2>I'm not able to write a tiled tiff =
file. The=20
problem is TIFFWriteTile is not writing the amount of data being read by =

TIFFReadTile</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>TIFFReadTile reads in 16384 bytes but =
TIFFWriteTile=20
writes out only 2048 bytes.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Can anyone tell what's going wrong? =
(it's a single=20
band img. and I set the tags also).</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Code:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; for(y =3D 0; y &lt; =
imageLength; y=20
+=3D tileLength) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for(x =3D 0; x &lt; =
imageWidth;=20
x +=3D tileWidth) {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size =
=3D=20
TIFFReadTile(tif, buf, x, y, 0,=20
0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("read %d =
bytes\n",=20
size);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=20
count++;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("tile: =
%d\n",=20
count);<BR></FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /*=20
RGBTOLHS */<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; =
/*Rgb2Lhs(&amp;bufR,=20
&amp;bufG, &amp;bufB, &amp;L, &amp;H, &amp;S, tileLength,=20
tileWidth);*/<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; size =3D=20
TIFFWriteTile(wtif, buf, x, y, 0,=20
0);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("written %d =
bytes\n",=20
size);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("width %d =
bytes\n",=20
x);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printf("length %d =
bytes\n",=20
y&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; =
}<BR></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Pushkar =
Pradhan</FONT></DIV></BODY></HTML>

------=_NextPart_000_0BB8_01C3583D.E61D38F0--

