Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas001.isp.belgacom.be (localhost [127.0.0.1])
        by inav005.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k1L3twdr019419
        for <joris.at.lebbeke@skynet.be>; Tue, 21 Feb 2006 04:55:58 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx013.isp.belgacom.be (inmx013.isp.belgacom.be [195.238.4.216])
        by inas001.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k1L3tqPw011915
        for <joris.at.lebbeke@skynet.be>; Tue, 21 Feb 2006 04:55:53 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx013.isp.belgacom.be (8.12.11/8.12.11/Skynet-IN-2.32) with ESMTP id k1L3tn4s005217
        for <joris.at.lebbeke@skynet.be>; Tue, 21 Feb 2006 04:55:49 +0100
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (duke.maptools.org [127.0.0.1])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k1L3otVB029323;
	Mon, 20 Feb 2006 22:51:30 -0500
Received: from nproxy.gmail.com (nproxy.gmail.com [64.233.182.199])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k1L3oqkq029320
	for <tiff@lists.maptools.org>; Mon, 20 Feb 2006 22:50:52 -0500
Received: by nproxy.gmail.com with SMTP id n15so733958nfc
	for <tiff@lists.maptools.org>; Mon, 20 Feb 2006 19:50:50 -0800 (PST)
DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com;
	h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references;
	b=jX0ptlCxPt5K+CfpRMstFqJAx8C3eZGQhn2oy7VzNlsyAecmqyl2KqWfiyPf9fkDfpHlUH4tUPZ5BrbOM5kNyA1RgvK4zLIXpm0zRYcRdB+hvrFnN2tjYLH6S9xkJQ97mCNIftlFnihvIBvKtqLOJC5aaA6Od+QYFvLfTwGDvGE=
Received: by 10.49.68.11 with SMTP id v11mr1400212nfk;
	Mon, 20 Feb 2006 19:50:50 -0800 (PST)
Received: by 10.48.30.17 with HTTP; Mon, 20 Feb 2006 19:50:50 -0800 (PST)
Message-ID: <9e46d1bb0602201950s2892a7ecs37ba1493490736f5@mail.gmail.com>
Date: Mon, 20 Feb 2006 19:50:50 -0800
From: Benares <benarestham@gmail.com>
To: "Chris Cox" <ccox@adobe.com>, tiff@lists.maptools.org
Subject: Re: [Tiff] TIFFReadScanline query
In-Reply-To: <C01F728D.282D0%ccox@adobe.com>
MIME-Version: 1.0
References: <9e46d1bb0602192354k39768df3tb290d0a5fa8bf59f@mail.gmail.com>
	<C01F728D.282D0%ccox@adobe.com>
Cc: 
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.4
Precedence: list
List-Id: TIFF and libtiff discussion <tiff.lists.maptools.org>
List-Unsubscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=unsubscribe>
List-Archive: <http://lists.maptools.org/mailman/private/tiff>
List-Post: <mailto:tiff@lists.maptools.org>
List-Help: <mailto:tiff-request@lists.maptools.org?subject=help>
List-Subscribe: <http://lists.maptools.org/mailman/listinfo/tiff>,
	<mailto:tiff-request@lists.maptools.org?subject=subscribe>
Content-Type: multipart/mixed; boundary="===============1444642333=="
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.0000130d
X-MSP-STORE: Tue, 21 Feb 2006 04:56:00 +0100
Status:   

--===============1444642333==
Content-Type: multipart/alternative; 
	boundary="----=_Part_12441_9907843.1140493850217"

------=_Part_12441_9907843.1140493850217
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi Chris, thanks for your reply to my newbish query!

I'm pretty sure the tiff file that I was trying to parse is the actual file
and not the thumbnail file, since the thumbnail file is of a much smaller
resolution as compared to the actual file. In addition, my output file usin=
g
the snipplet of codes I've quoted in my previous entry, had almost the same
dimension as the original, just that this output.tif appears to be in
columns of pure Red, Green, Blue, Black and this pattern repeats till the
end of the image width.

As for the RAW file format, I'm not too sure about it. How'd you
categorise/deduce that the camera saves the file in RAW format ? Since,
after playing with the camera's interface and reading on its output format
types off the net, I'm not sure if uncompressed tiff file format equals to
RAW. Could anybody enlighten me on this ?

Do refer to the URLs below to get a clearer picture of what I meant, as the=
y
say, a picture speaks a million words. I'm really sorry for not being able
to phrase my question properly. Nonetheless, thanks a lot again for all the
assistance!

http://home.pacific.net.sg/~benares/ben_sample.tif <- before
http://home.pacific.net.sg/~benares/output.tif <- after
(p/s: maximise your browser if you've difficulty viewing the picture off th=
e
website.)

Rgds,
benares

On 2/21/06, Chris Cox <ccox@adobe.com> wrote:
>
> That sounds like you're getting the thumbnail image and not the full size
> image.
> Are you sure this camera isn't saving a RAW file and you're just reading
> the RGB thumbnail?
>
> Chris
>
>
>
> On 2/19/06 11:54 PM, "Benares" <benarestham@gmail.com> wrote:
>
> I've some difficulty parsing the tiff image information into a raster
> array to hold these values, processing the raster data then write the
> resulting data into another tiff image. I've tried using the
> TIFFReadScanline function to parse these data, however my image would not
> appear as the original. I'm wondering where actually went wrong. Could
> anybody help advise?
>
> My tiff file is extracted from a Kodak digital camera model DC290. The
> default file information are as follows.
>
> IMAGEWIDTH: 720
> IMAGEHEIGHT: 480
> SAMPLESPERPIXEL: 3
> ROWSPERSTRIP: 3
> BITSPERSAMPLE: 8
> PLANARCONFIG: 1 (Chunky)
> ORIENTATION: 1 (Top-Left)
> PHOTOMETRIC: 2 (RGB)
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DReading in th=
e image information into
> pic_buffer=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>     int j, k, row_counter, offset;
>     tsize_t ScanlineSize =3D TIFFScanlineSize(tiffRead);
>       //ScanlineSize =3D 2160 =3D 720*3
>
>     uint32* pic_buffer =3D (uint32*)_TIFFmalloc(sizeof(uint32) * imageWid=
th
> * imageHeight);
>     uint32* line_buffer =3D (uint32*)_TIFFmalloc(sizeof(uint32) *
> ScanlineSize);
>
>     k=3D0;
>     for (row_counter=3D0; row_counter<imageHeight; row_counter++)
>     {
>         TIFFReadScanline(tiffRead , line_buffer , row_counter);
>        for( j=3D0; j<ScanlineSize; j+=3D3 )           //reading RGB value=
 from
> file and combining into pixel[k]
>         {
>            pic_buffer[k] =3D    ( ((((uint32)line_buffer[j]) <<8<<8
> )&0x00FF0000)
>                           | ((((uint32)line_buffer[j+1]) <<8 )&0x0000FF00=
)
>                           | (((uint32)line_buffer[j+2])&0x000000FF) );
>             k++;
>         }
>     }
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DReading in th=
e image information into
> pic_buffer=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DWriting th=
e image information into
> output.tif=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>     for (row_counter=3D0; row_counter<imageHeight; row_counter++)
>     {
>         k=3D0;
>         offset =3D row_counter*imageWidth;
>         for (j=3D0; j<imageWidth; j++)
>         {
>            line_buffer[k] =3D
> (uint32)((pic_buffer[j+offset]&0x00FF0000)>>8>>8);       //Red content
>            line_buffer[k+1] =3D
> (uint32)((pic_buffer[j+offset]&0x0000FF00)>>8);       //Green content
>            line_buffer[k+2] =3D (uint32)(pic_buffer[j+offset]&0x000000FF)=
;
>           //Blue content
>             k+=3D3;
>         }
>         TIFFWriteScanline(tiffWrite, line_buffer , row_counter, 0);
>     }
> =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DWriting th=
e image information into
> output.tif=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
>
> Thanks to all whom have read and/or made a reply to this amateurish entry=
.
>
> ------------------------------
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/
>
>
>

------=_Part_12441_9907843.1140493850217
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi Chris, thanks for your reply to my newbish query!<br>
<br>
I'm pretty sure the tiff file that I was trying to parse is the actual
file and not the thumbnail file, since the thumbnail file is of a much
smaller resolution as compared to the actual file. In addition, my
output file using the snipplet of codes I've quoted in my previous
entry, had almost the same dimension as the original, just that this
output.tif appears to be in columns of pure Red, Green, Blue, Black and
this pattern repeats till the end of the image width.<br>
<br>
As for the RAW file format, I'm not too sure about it. How'd you
categorise/deduce that the camera saves the file in RAW format ? Since,
after playing with the camera's interface and reading on its output
format types off the net, I'm not sure if uncompressed tiff file format
equals to RAW. Could anybody enlighten me on this ?<br>
<br>
Do refer to the URLs below to get a clearer picture of what I meant, as
they say, a picture speaks a million words. I'm really sorry for not
being able to phrase my question properly. Nonetheless, thanks a lot
again for all the assistance!<br>
<br>
<a href=3D"http://home.pacific.net.sg/~benares/ben_sample.tif">http://home.=
pacific.net.sg/~benares/ben_sample.tif</a> &lt;- before<br>
<a href=3D"http://home.pacific.net.sg/~benares/output.tif">http://home.paci=
fic.net.sg/~benares/output.tif</a> &lt;- after<br>
(p/s: maximise your browser if you've difficulty viewing the picture off th=
e website.)<br>
<br>
Rgds,<br>
benares<br><br><div><span class=3D"gmail_quote">On 2/21/06, <b class=3D"gma=
il_sendername">Chris Cox</b> &lt;<a href=3D"mailto:ccox@adobe.com" target=
=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,event,this)">ccox@a=
dobe.com
</a>&gt; wrote:</span><blockquote class=3D"gmail_quote" style=3D"border-lef=
t: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1=
ex;">





<font face=3D"Verdana, Helvetica, Arial"><span style=3D"font-size: 12px;">T=
hat sounds like you're getting the thumbnail image and not the full size im=
age.<br>
Are you sure this camera isn't saving a RAW file and you're just reading th=
e RGB thumbnail?<br>
<br>
Chris<div><span><br>
<br>
<br>
<br>
On 2/19/06 11:54 PM, &quot;Benares&quot; &lt;<a href=3D"mailto:benarestham@=
gmail.com" target=3D"_blank" onclick=3D"return top.js.OpenExtLink(window,ev=
ent,this)">benarestham@gmail.com</a>&gt; wrote:<br>
<br>
</span></div></span></font><blockquote><font face=3D"Verdana, Helvetica, Ar=
ial"><span style=3D"font-size: 12px;"><div><span>I've
some difficulty parsing the tiff image information into a raster array
to hold these values, processing the raster data then write the
resulting data into another tiff image. I've tried using the
TIFFReadScanline function to parse these data, however my image would
not appear as the original. I'm wondering where actually went wrong.
Could anybody help advise?<br>
<br>
My tiff file is extracted from a Kodak digital camera model DC290. The defa=
ult file information are as follows.<br>
<br>
IMAGEWIDTH: 720<br>
IMAGEHEIGHT: 480<br>
SAMPLESPERPIXEL: 3<br>
ROWSPERSTRIP: 3<br>
BITSPERSAMPLE: 8<br>
PLANARCONFIG: 1 (Chunky)<br>
ORIENTATION: 1 (Top-Left)<br>
PHOTOMETRIC: 2 (RGB)<br>
<br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DReading in the =
image information into pic_buffer=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D<br>
&nbsp;&nbsp;&nbsp;&nbsp;int j, k, row_counter, offset;<br>
&nbsp;&nbsp;&nbsp;&nbsp;tsize_t ScanlineSize =3D
TIFFScanlineSize(tiffRead);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//ScanlineSize =3D 2160 =3D 720*3<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;uint32* pic_buffer =3D (uint32*)_TIFFmalloc(sizeof(=
uint32) * imageWidth * imageHeight);<br>
&nbsp;&nbsp;&nbsp;&nbsp;uint32* line_buffer =3D (uint32*)_TIFFmalloc(sizeof=
(uint32) * ScanlineSize);<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;k=3D0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;for (row_counter=3D0; row_counter&lt;imageHeight; r=
ow_counter++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFReadScanline(tiffRead ,=
 line_buffer , row_counter);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for( j=3D0; j&lt;ScanlineSize;
j+=3D3 )
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//reading
RGB value from file and combining into pixel[k]<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;pic_buffe=
r[k]
=3D &nbsp;&nbsp;&nbsp;( ((((uint32)line_buffer[j]) &lt;&lt;8&lt;&lt;8
)&amp;0x00FF0000)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;|
((((uint32)line_buffer[j+1]) &lt;&lt;8 )&amp;0x0000FF00)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb=
sp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=
&nbsp;|
(((uint32)line_buffer[j+2])&amp;0x000000FF) );<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;k++=
;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DReading in the =
image information into pic_buffer=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D<br>
<br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DWriting the =
image information into output.tif=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D<br>
&nbsp;&nbsp;&nbsp;&nbsp;for (row_counter=3D0; row_counter&lt;imageHeight; r=
ow_counter++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;k=3D0;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;offset =3D row_counter*imag=
eWidth;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;for (j=3D0; j&lt;imageWidth=
; j++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line_buff=
er[k] =3D (uint32)((pic_buffer[j+offset]&amp;0x00FF0000)&gt;&gt;8&gt;&gt;8)=
; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Red content<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line_buff=
er[k+1] =3D (uint32)((pic_buffer[j+offset]&amp;0x0000FF00)&gt;&gt;8); &nbsp=
;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Green content<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;line_buff=
er[k+2] =3D (uint32)(pic_buffer[j+offset]&amp;0x000000FF); &nbsp;&nbsp;&nbs=
p;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//Blue content<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;k+=
=3D3;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TIFFWriteScanline(tiffWrite=
, line_buffer , row_counter, 0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;}<br>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3DWriting the =
image information into output.tif=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D<br>
<br>
Thanks to all whom have read and/or made a reply to this amateurish entry.<=
br>
<br></span></div>
<hr align=3D"center" size=3D"3" width=3D"95%"></span></font><font size=3D"2=
"><font face=3D"Monaco, Courier New"><span style=3D"font-size: 10px;">_____=
__________________________________________<br>
Tiff mailing list: <a href=3D"mailto:Tiff@lists.maptools.org" target=3D"_bl=
ank" onclick=3D"return top.js.OpenExtLink(window,event,this)">Tiff@lists.ma=
ptools.org</a><br>
<a href=3D"http://lists.maptools.org/mailman/listinfo/tiff" target=3D"_blan=
k" onclick=3D"return top.js.OpenExtLink(window,event,this)">http://lists.ma=
ptools.org/mailman/listinfo/tiff</a><br>
<a href=3D"http://www.remotesensing.org/libtiff/" target=3D"_blank" onclick=
=3D"return top.js.OpenExtLink(window,event,this)">http://www.remotesensing.=
org/libtiff/</a><br>
</span></font></font></blockquote><font size=3D"2"><font face=3D"Monaco, Co=
urier New"><span style=3D"font-size: 10px;"><br>
</span></font></font>




</blockquote></div>

------=_Part_12441_9907843.1140493850217--

--===============1444642333==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
--===============1444642333==--
