Return-Path: <tiff-bounces@lists.maptools.org>
Received: from inas015.isp.belgacom.be (localhost [127.0.0.1])
        by inav027.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AV-3.00) with ESMTP id k546qU3m030056
        for <joris.at.lebbeke@skynet.be>; Sun, 4 Jun 2006 08:52:30 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from inmx017.isp.belgacom.be (inmx017.isp.belgacom.be [195.238.4.129])
        by inas015.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-AS-2.03) with ESMTP id k546qJ03016632
        for <joris.at.lebbeke@skynet.be>; Sun, 4 Jun 2006 08:52:19 +0200
        (envelope-from <tiff-bounces@lists.maptools.org>)
Received: from duke.maptools.org (r153.dmsolutions.ca [209.217.116.153] (may be forged))
        by inmx017.isp.belgacom.be (8.12.11.20060308/8.12.11/Skynet-IN-2.32) with ESMTP id k546qFmC013994
        for <joris.at.lebbeke@skynet.be>; Sun, 4 Jun 2006 08:52:15 +0200
        (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 k546kiOd015225;
	Sun, 4 Jun 2006 02:47:03 -0400
Received: from rose.ctd.hcltech.com (rose.ctd.hcltech.com [202.54.64.23])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id k546kdKM015222
	for <tiff@lists.maptools.org>; Sun, 4 Jun 2006 02:46:40 -0400
X-MessageTextProcessor: DisclaimIt (2.50.252) [HCL Technologies Limited]
Content-Class: urn:content-classes:message
Received: from Ganesh.ctd.hcltech.com ([202.54.64.2]) by rose.ctd.hcltech.com
	with Microsoft SMTPSVC(5.0.2195.6713); Sun, 4 Jun 2006 12:16:37 +0530
Received: by Ganesh.ctd.hcltech.com with Internet Mail Service (5.5.2653.19)
	id <K6A2MZ7L>; Sun, 4 Jun 2006 12:16:37 +0530
Message-ID: <012301731C23DE4DBFE035647C68F1CC033B2A3C@sindhu.ctd.hcltech.com>
From: "Venkatasalapathy D - TLS , Chennai" <Venkatasalapathyd@hcl.in>
To: "Alex Ryu" <ryu.alex@gmail.com>, <tiff@lists.maptools.org>
Subject: RE: [Tiff] Segfault
Date: Sun, 4 Jun 2006 12:16:36 +0530 
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106
MIME-Version: 1.0
X-Mailer: Internet Mail Service (5.5.2653.19)
X-OriginalArrivalTime: 04 Jun 2006 06:46:37.0708 (UTC)
	FILETIME=[A0B18CC0:01C687A2]
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="===============1225820644=="
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00001761
X-MSP-STORE: Sun, 04 Jun 2006 08:52:32 +0200
Status:   

This is a multi-part message in MIME format.

--===============1225820644==
Content-Class: urn:content-classes:message
Content-Type: multipart/alternative;
	boundary="----_=_NextPart_001_01C687A2.A01ED13C"

This is a multi-part message in MIME format.

------_=_NextPart_001_01C687A2.A01ED13C
Content-Transfer-Encoding: quoted-printable
Content-Type: text/plain;
	charset="Windows-1252"

Hi,

=20

Thanks for your reply

=20

We need for 48 bit color TIFF read and write sample code.

=20

Note: For 48 bit, every pixel data stored in 6 byte (48 bit). But your =
data
type 'raster' (uint32) is 4 byte.

=20

Please help me and give sample code for 48 bit color read and write.

=20

Thanks & Regards,

Venkat D

=20

=20

  _____ =20

From: tiff-bounces@lists.maptools.org
[mailto:tiff-bounces@lists.maptools.org] On Behalf Of Alex Ryu
Sent: Sunday, June 04, 2006 12:05 PM
To: tiff@lists.maptools.org
Subject: [Tiff] Segfault

=20

Hi, I'm new to image processing and pretty new to C, so please excuse me =
if
I ask any dumb questions.
I keep getting a segmentation fault when I run this code:=20

[code]
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <tiffio.h>

int main()
{
    FILE *fp;
    fp =3D fopen("c:\\output.txt", "w");
    TIFF *tif;
    int i, j;
    uint32 w, h, npixels;
    uint32 *raster;
    TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &w);
    TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &h); /*length =3D height*/
    tif =3D TIFFOpen("c:\\image1.tif", "r");
    npixels =3D w * h;
    raster =3D (uint32*) _TIFFmalloc(npixels * sizeof(uint32));
    TIFFReadRGBAImage(tif, w, h, raster, 0);
    for (i =3D 0; i < h; i++)
    {
        for (j =3D 0; j < w; j++)
        {
            if ((i*w + j)%h =3D=3D 0) printf("\n");
            fprintf(fp,"%d ", raster[i*w + j]);
        }
    }
   =20
    return 0;
}
[/code]
For the life of me it looks like I'm overstepping the array bounds, but =
I've
doublechecked it several times.  I'm on WinXP. Thanks for your help
Alex
DISCLAIMER=20
The contents of this e-mail and any attachment(s) are confidential and =
intended for the=20

named recipient(s) only. It shall not attach any liability on the =
originator or HCL or its=20

affiliates. Any views or opinions presented in this email are solely =
those of the author and=20

may not necessarily reflect the opinions of HCL or its affiliates. Any =
form of reproduction,=20

dissemination, copying, disclosure, modification, distribution and / or =
publication of this=20

message without the prior written consent of the author of this e-mail =
is strictly=20

prohibited. If you have received this email in error please delete it =
and notify the sender=20

immediately. Before opening any mail and attachments please check them =
for viruses and=20

defect.

------_=_NextPart_001_01C687A2.A01ED13C
Content-Type: text/html;
	charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable

<html xmlns:v=3D"urn:schemas-microsoft-com:vml" =
xmlns:o=3D"urn:schemas-microsoft-com:office:office" =
xmlns:w=3D"urn:schemas-microsoft-com:office:word" =
xmlns:st1=3D"urn:schemas-microsoft-com:office:smarttags" =
xmlns=3D"http://www.w3.org/TR/REC-html40">

<head>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">


<meta name=3DGenerator content=3D"Microsoft Word 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]--><o:SmartTagType
 namespaceuri=3D"urn:schemas-microsoft-com:office:smarttags" =
name=3D"PersonName"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Font Definitions */
 @font-face
	{font-family:"MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
@font-face
	{font-family:Tahoma;
	panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
	{font-family:"\@MS Mincho";
	panose-1:2 2 6 9 4 2 5 8 3 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0in;
	margin-bottom:.0001pt;
	font-size:12.0pt;
	font-family:"Times New Roman";}
a:link, span.MsoHyperlink
	{color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{color:purple;
	text-decoration:underline;}
span.EmailStyle17
	{mso-style-type:personal-reply;
	font-family:Arial;
	color:navy;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
	{page:Section1;}
-->
</style>

</head>

<body lang=3DEN-US link=3Dblue vlink=3Dpurple>

<div class=3DSection1>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Hi,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Thanks for your =
reply<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>We need for 48 bit color TIFF read =
and
write sample code.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Note: For 48 bit, every pixel data =
stored
in 6 byte (48 bit). But your data type &#8216;raster&#8217; (uint32) is =
4 byte.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Please help me and give sample code =
for 48
bit color read and write.<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Thanks &amp; =
Regards,<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'>Venkat =
D<o:p></o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal><font size=3D2 color=3Dnavy face=3DArial><span =
style=3D'font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=3DMsoNormal align=3Dcenter style=3D'text-align:center'><font =
size=3D3
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>

<hr size=3D2 width=3D"100%" align=3Dcenter tabindex=3D-1>

</span></font></div>

<p class=3DMsoNormal><b><font size=3D2 face=3DTahoma><span =
style=3D'font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font =
size=3D2
face=3DTahoma><span style=3D'font-size:10.0pt;font-family:Tahoma'>
tiff-bounces@lists.maptools.org [mailto:tiff-bounces@lists.maptools.org] =
<b><span
style=3D'font-weight:bold'>On Behalf Of </span></b>Alex Ryu<br>
<b><span style=3D'font-weight:bold'>Sent:</span></b> Sunday, June 04, =
2006 12:05
PM<br>
<b><span style=3D'font-weight:bold'>To:</span></b> <st1:PersonName =
w:st=3D"on">tiff@lists.maptools.org</st1:PersonName><br>
<b><span style=3D'font-weight:bold'>Subject:</span></b> [Tiff] =
Segfault</span></font><o:p></o:p></p>

</div>

<p class=3DMsoNormal><font size=3D3 face=3D"Times New Roman"><span =
style=3D'font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p class=3DMsoNormal style=3D'margin-bottom:12.0pt'><font size=3D3
face=3D"Times New Roman"><span style=3D'font-size:12.0pt'>Hi, I'm new to =
image
processing and pretty new to C, so please excuse me if I ask any dumb
questions.<br>
I keep getting a segmentation fault when I run this code: <br>
<br>
[code]<br>
#include &lt;stdio.h&gt;<br>
#include &lt;stdlib.h&gt;<br>
#include &lt;math.h&gt;<br>
#include &lt;tiffio.h&gt;<br>
<br>
int main()<br>
{<br>
&nbsp;&nbsp;&nbsp; FILE *fp;<br>
&nbsp;&nbsp;&nbsp; fp =3D fopen(&quot;c:\\output.txt&quot;, =
&quot;w&quot;);<br>
&nbsp;&nbsp;&nbsp; TIFF *tif;<br>
&nbsp;&nbsp;&nbsp; int i, j;<br>
&nbsp;&nbsp;&nbsp; uint32 w, h, npixels;<br>
&nbsp;&nbsp;&nbsp; uint32 *raster;<br>
&nbsp;&nbsp;&nbsp; TIFFGetField(tif, TIFFTAG_IMAGEWIDTH, &amp;w);<br>
&nbsp;&nbsp;&nbsp; TIFFGetField(tif, TIFFTAG_IMAGELENGTH, &amp;h); =
/*length =3D
height*/<br>
&nbsp;&nbsp;&nbsp; tif =3D TIFFOpen(&quot;c:\\image1.tif&quot;, =
&quot;r&quot;);<br>
&nbsp;&nbsp;&nbsp; npixels =3D w * h;<br>
&nbsp;&nbsp;&nbsp; raster =3D (uint32*) _TIFFmalloc(npixels * =
sizeof(uint32));<br>
&nbsp;&nbsp;&nbsp; TIFFReadRGBAImage(tif, w, h, raster, 0);<br>
&nbsp;&nbsp;&nbsp; for (i =3D 0; i &lt; h; i++)<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (j =3D 0; j &lt; w; =
j++)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if =
((i*w +
j)%h =3D=3D 0) printf(&quot;\n&quot;);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
fprintf(fp,&quot;%d &quot;, raster[i*w + j]);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp; return 0;<br>
}<br>
[/code]<br>
For the life of me it looks like I'm overstepping the array bounds, but =
I've
doublechecked it several times.&nbsp; I'm on WinXP. Thanks for your =
help<br>
Alex<o:p></o:p></span></font></p>

</div>

<div><p><font size=3D"1">
<a><b>DISCLAIMER:<br>=20
The contents of this e-mail and any attachment(s) are confidential and =
intended for the=20

named recipient(s) only. It shall not attach any liability on the =
originator or HCL or its=20

affiliates. Any views or opinions presented in this email are solely =
those of the author and=20

may not necessarily reflect the opinions of HCL or its affiliates. Any =
form of reproduction,=20

dissemination, copying, disclosure, modification, distribution and / or =
publication of this=20

message without the prior written consent of the author of this e-mail =
is strictly=20

prohibited. If you have received this email in error please delete it =
and notify the sender=20

immediately. Before opening any mail and attachments please check them =
for viruses and=20

defect.
</a>

</font></p></div>
</body>

</html>

------_=_NextPart_001_01C687A2.A01ED13C--

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