Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-j.b-one.net (mx-j.one.com [91.198.169.57])
	by mail9.b-one.net (Postfix) with ESMTP id 4BA21400437
	for <info@awaresystems.be>; Sat, 15 Aug 2009 05:51:50 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Spam-Score: 0.001
X-Spam-Level: 
X-Spam-Status: No, score=0.001 tagged_above=0 required=6
	tests=[HTML_MESSAGE=0.001]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144])
	by mx-j.b-one.net (Postfix) with ESMTP id 8FB264A8262
	for <info@awaresystems.be>; Sat, 15 Aug 2009 05:51:49 +0200 (CEST)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 25F711D18B138;
	Fri, 14 Aug 2009 22:49:15 -0500 (EST)
Received: from mail-yw0-f188.google.com (mail-yw0-f188.google.com
	[209.85.211.188])
	by lists.maptools.org (Postfix) with ESMTP id A08E71D191B4C
	for <tiff@lists.maptools.org>; Fri, 14 Aug 2009 22:45:03 -0500 (EST)
Received: by ywh26 with SMTP id 26so2568418ywh.5
	for <tiff@lists.maptools.org>; Fri, 14 Aug 2009 20:45:03 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.151.4.10 with SMTP id g10mr3196160ybi.181.1250307903437; Fri, 
	14 Aug 2009 20:45:03 -0700 (PDT)
Date: Fri, 14 Aug 2009 23:45:03 -0400
Message-ID: <c2fdd35e0908142045o76e91afdoa6accb901cafc098@mail.gmail.com>
From: Dave Sun <hotdog.sun@gmail.com>
To: tiff@lists.maptools.org
Subject: [Tiff] scanline size and image width
X-BeenThere: tiff@lists.maptools.org
X-Mailman-Version: 2.1.9
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="===============0787960773=="
Mime-version: 1.0
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

--===============0787960773==
Content-Type: multipart/alternative; boundary=000e0cd25a8871bcfd047125fec0

--000e0cd25a8871bcfd047125fec0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: 7bit

Question shor version:

why scanlinesize is 1024 while my image width is 512?

Long version of the question is following:


I have 16 bit gray image, 512x512,

when I checked


linesize = TIFFScanlineSize(image);

it gives me 1024;


to read in the image, I used following



buffer = (char*)_TIFFmalloc(linesize*height);

for(int i=0; i< height; i++)

TIFFReadScanline(image, &buffer[i*linesize], i);


It works well.


Now I want to get the pixel values and found that




for(int i=0; i < 512*512; i++){

//cout << i << "\t" << ((uint16 *)buffer)[i] << endl;

imageList.push_back(((uint16 *)buffer)[i]);

}


works. Note 512*512 (image width * image height, but not 1024*512,
scanlinesize*image height).


My question is why scanlinesize is twice bigger as the image width?




Thank you.
Any suggestion is welcome.

--000e0cd25a8871bcfd047125fec0
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Question shor version:<br><br>why scanlinesize is 1024 while my image width=
 is 512? <br><br>Long version of the question is following:<br><br><br>I ha=
ve 16 bit gray image, 512x512, <br><br>when I checked <br>
<meta name=3D"qrichtext" content=3D"1"><meta http-equiv=3D"Content-Type" co=
ntent=3D"text/html; charset=3Dutf-8"><style type=3D"text/css">
p, li { white-space: pre-wrap; }
</style>
<p style=3D"margin: 0px; text-indent: 0px;"><br></p><p style=3D"margin: 0px=
; text-indent: 0px;">linesize =3D TIFFScanlineSize(image);</p><p style=3D"m=
argin: 0px; text-indent: 0px;">it gives me 1024; <br></p><p style=3D"margin=
: 0px; text-indent: 0px;">
<br></p><p style=3D"margin: 0px; text-indent: 0px;">to read in the image, I=
 used following</p><p style=3D"margin: 0px; text-indent: 0px;"><br><meta na=
me=3D"qrichtext" content=3D"1"><meta http-equiv=3D"Content-Type" content=3D=
"text/html; charset=3Dutf-8"><style type=3D"text/css">
p, li { white-space: pre-wrap; }</style><br></p><p style=3D"margin: 0px; te=
xt-indent: 0px;">buffer =3D (char*)_TIFFmalloc(linesize*height);</p>
<p style=3D"margin: 0px; text-indent: 0px;">  for(int i=3D0; i&lt; height; =
i++)</p>
<p style=3D"margin: 0px; text-indent: 0px;">     TIFFReadScanline(image, &a=
mp;buffer[i*linesize], i);</p><p style=3D"margin: 0px; text-indent: 0px;"><=
br></p><p style=3D"margin: 0px; text-indent: 0px;">It works well. <br></p><=
p style=3D"margin: 0px; text-indent: 0px;">
<br></p><p style=3D"margin: 0px; text-indent: 0px;">Now I want to get the p=
ixel values and found that <br></p><p style=3D"margin: 0px; text-indent: 0p=
x;"><br></p><p style=3D"margin: 0px; text-indent: 0px;"><br><meta name=3D"q=
richtext" content=3D"1"><meta http-equiv=3D"Content-Type" content=3D"text/h=
tml; charset=3Dutf-8"><style type=3D"text/css">
p, li { white-space: </style><br></p><p style=3D"margin: 0px; text-indent: =
0px;">for(int i=3D0; i &lt; 512*512; i++){</p>
<p style=3D"margin: 0px; text-indent: 0px;">      //cout &lt;&lt; i &lt;&lt=
; &quot;\t&quot; &lt;&lt; ((uint16 *)buffer)[i] &lt;&lt; endl;</p>
<p style=3D"margin: 0px; text-indent: 0px;">        imageList.push_back(((u=
int16 *)buffer)[i]);</p>
<p style=3D"margin: 0px; text-indent: 0px;">    }</p><p style=3D"margin: 0p=
x; text-indent: 0px;"><br></p><p style=3D"margin: 0px; text-indent: 0px;">w=
orks. Note 512*512 (image width * image height,  but not 1024*512, scanline=
size*image height). <br>
</p><p style=3D"margin: 0px; text-indent: 0px;"><br></p><p style=3D"margin:=
 0px; text-indent: 0px;">My question is why scanlinesize is twice bigger as=
 the image width? <br></p><p></p><p></p><br><br><br>Thank you. <br>Any sugg=
estion is welcome. <br>

--000e0cd25a8871bcfd047125fec0--

--===============0787960773==
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/
--===============0787960773==--
