Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx-q.one.com (mx-q.one.com [91.198.169.248])
	by mail6.local (Postfix) with ESMTP id 72C998014FAC9
	for <filtered@awaresystems.be>; Tue,  8 Oct 2013 12:04:55 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "MIME-Version"
Received-SPF: pass (mx-q: domain of awaresystems.be+caf_=filtered=awaresystems.be@gmail.com designates 209.85.215.42 as permitted sender)
X-Greylist: whitelisted by SQLgrey-1.8.0-rc2
Received: from mail-la0-f42.google.com (mail-la0-f42.google.com [209.85.215.42])
	by mx-q.one.com (Postfix) with ESMTP id 23771A1650F
	for <filtered@awaresystems.be>; Tue,  8 Oct 2013 10:04:55 +0000 (UTC)
Received: by mail-la0-f42.google.com with SMTP id ep20so6760040lab.1
        for <filtered@awaresystems.be>; Tue, 08 Oct 2013 03:04:54 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=delivered-to:domainkey-status:delivered-to:from:to:date:message-id
         :mime-version:thread-index:content-language:subject:precedence
         :list-id:list-unsubscribe:list-archive:list-post:list-help
         :list-subscribe:content-type:mime-version:sender:errors-to;
        bh=aV7tI9b3suXcp/SOXPZ7hMjkqPp6EUV6OS8zSHXxgTY=;
        b=GkzgenHLP0Gr7Na51XxNIlqGmZ6/wn+DiFEKLxabEj8SN+ads1dnnS35d7erOKGzQP
         b7qOYwS3U9Cra+vPNAbM0xje3tAP9FDw+rGxAwl8xYdsJPIfwnaO2Ct3G0RtXO3ValR7
         yg5+93N5z2QOlFFAA32zCGjR0Hp3a/D50RyIy9zNFIQ3lKmLnOWTNy8PKdlpb0DMaqfw
         NVYnLRYXq2oYYvZ80xSvOGYtN7QPtJAjtlXkdwicov/CtTKo6B4QbZu7JEGtezCi6jYr
         dsnZSGkwxk9m/RYAHWA6pFTNnHXVZDKWxUTCRrw62+OTt8Uy0HBSdzfJtalK6UgBfdEP
         tJrQ==
X-Received: by 10.112.168.35 with SMTP id zt3mr1821458lbb.11.1381226694710;
        Tue, 08 Oct 2013 03:04:54 -0700 (PDT)
X-Forwarded-To: filtered@awaresystems.be
X-Forwarded-For: awaresystems.be@gmail.com filtered@awaresystems.be
Delivered-To: awaresystems.be@gmail.com
Received: by 10.114.2.237 with SMTP id 13csp166825ldx;
        Tue, 8 Oct 2013 03:04:54 -0700 (PDT)
X-Received: by 10.112.50.109 with SMTP id b13mr648850lbo.47.1381226693292;
        Tue, 08 Oct 2013 03:04:53 -0700 (PDT)
DomainKey-Status: bad format
Received-SPF: neutral (google.com: 195.47.247.72 is neither permitted nor denied by best guess record for domain of tiff-bounces@lists.maptools.org) client-ip=195.47.247.72;
Received: by 10.112.34.82 with POP3 id x18mf4397489lbi.31;
        Tue, 08 Oct 2013 03:04:53 -0700 (PDT)
X-Gmail-Fetch-Info: info@awaresystems.be 1 pop.awaresystems.be 110 info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx01.one.com (mx01.one.com [195.47.247.72])
	by mail6.local (Postfix) with ESMTP id 78B568014FAC8
	for <info@awaresystems.be>; Tue,  8 Oct 2013 12:03:33 +0200 (CEST)
X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "MIME-Version"
X-Greylist: domain auto-whitelisted by SQLgrey-1.8.0-rc2
Received: from lists.maptools.org (ks365428.kimsufi.com [94.23.4.142])
	by mx01.one.com (Postfix) with ESMTP id 3FA241CADE7C
	for <info@awaresystems.be>; Tue,  8 Oct 2013 10:03:33 +0000 (UTC)
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 1412535C03C;
	Tue,  8 Oct 2013 05:02:51 -0500 (EST)
Received: from relay2.muni.cz (relay2.muni.cz [147.251.4.34])
	by lists.maptools.org (Postfix) with ESMTPS id 2E4E435C037
	for <tiff@lists.maptools.org>; Tue,  8 Oct 2013 05:01:46 -0500 (EST)
Received: from anarionntb (kou-209-114.pks.muni.cz [147.251.209.114])
	by relay2.muni.cz (8.14.3/8.14.3/Debian-9.4) with ESMTP id
	r98A1jZI011451
	for <tiff@lists.maptools.org>; Tue, 8 Oct 2013 12:01:46 +0200
From: "Josef Olah" <anarion@tiscali.cz>
To: <tiff@lists.maptools.org>
Date: Tue, 8 Oct 2013 12:01:44 +0200
Message-ID: <000301cec40d$68777040$396650c0$@tiscali.cz>
MIME-Version: 1.0
X-Mailer: Microsoft Outlook 14.0
Thread-Index: Ac7ECaMmZ9BAAr+KSkmjCU+8rX1KNg==
Content-Language: cs
X-Muni-Spam-TestIP: 147.251.209.114
X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.7
	(relay2.muni.cz [147.251.4.35]);
	Tue, 08 Oct 2013 12:01:46 +0200 (CEST)
Subject: [Tiff] Problem with reading tiff exported from GDAL in C
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="===============1575414268=="
Mime-version: 1.0
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

This is a multipart message in MIME format.

--===============1575414268==
Content-Type: multipart/alternative;
	boundary="----=_NextPart_000_0004_01CEC41E.2C004040"
Content-Language: cs

This is a multipart message in MIME format.

------=_NextPart_000_0004_01CEC41E.2C004040
Content-Type: text/plain;
	charset="us-ascii"
Content-Transfer-Encoding: 7bit

Hello,

 

I'm using libtiff library in my diploma thesis, but I encountered a problem,
when I wanted to read image data in C language.

I have tiff image exported from GDAL:

https://www.dropbox.com/s/r6p1j06gg7a1vh2/BK4_10_rad_Export_line_2.tif

(histogram stretch is needed for good view (e.g. using QGIS))

which is composed of three channels (RGB). Original GDAL data file was
composed of 65 channels, but I GDALRasterIO-ed it into RGB.

Now I'd like to read this tiff file using methods from libtiff webpage
(http://www.remotesensing.org/libtiff/libtiff.html#tiffrgbaimage),

but when I'm using  either the first or the second method (i.e.
TIFFReadRGBAImage or TIFFRGBAImageBegin/TIFFRGBAImageGet/TIFFRGBAImageEnd)

I'm still facing the same problem during debugging in VS2012

(Unhandled exception at 0x6FDB01C0 (libtiff3.dll) in
ConsoleApplication1.exe: 0xC0000005: Access violation reading location
0x0105C001.).

Here is part of my C code:

 

TIFF* tif_load;

uint32 w, h;

size_t npixels;

uint32* raster;

 

tif_load = TIFFOpen("C:/./BK4_10_rad_Export_line_2.tif", "r");

 

TIFFGetField(tif_load, TIFFTAG_IMAGEWIDTH, &w);

TIFFGetField(tif_load, TIFFTAG_IMAGELENGTH, &h);

 

npixels = w * h;

raster = (uint32*) _TIFFmalloc(npixels*sizeof(uint32));

TIFFReadRGBAImage(tif_load, w, h, raster, 0);

 

//working with raster      

 

_TIFFfree(raster);

TIFFClose(tif_load);

 

I really don't know where is that issue, so I hope someone will help me.

 

Thank you in advance and sorry for my English.

 

Best regards, Josef Olah


------=_NextPart_000_0004_01CEC41E.2C004040
Content-Type: text/html;
	charset="us-ascii"
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:m=3D"http://schemas.microsoft.com/office/2004/12/omml" =
xmlns=3D"http://www.w3.org/TR/REC-html40"><head><meta =
http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dus-ascii"><meta name=3DGenerator content=3D"Microsoft Word 14 =
(filtered medium)"><style><!--
/* Font Definitions */
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
	{font-family:Consolas;
	panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
	{margin:0cm;
	margin-bottom:.0001pt;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
	{mso-style-priority:99;
	color:blue;
	text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-priority:99;
	color:purple;
	text-decoration:underline;}
tt
	{mso-style-priority:99;
	font-family:"Courier New";}
span.StylE-mailovZprvy17
	{mso-style-type:personal-compose;
	font-family:"Calibri","sans-serif";
	color:windowtext;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-fareast-language:EN-US;}
@page WordSection1
	{size:612.0pt 792.0pt;
	margin:70.85pt 70.85pt 70.85pt 70.85pt;}
div.WordSection1
	{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext=3D"edit" spidmax=3D"1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext=3D"edit">
<o:idmap v:ext=3D"edit" data=3D"1" />
</o:shapelayout></xml><![endif]--></head><body lang=3DCS link=3Dblue =
vlink=3Dpurple><div class=3DWordSection1><p =
class=3DMsoNormal>Hello,<o:p></o:p></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>I<span =
lang=3DEN-US>&#8217;m using libtiff library in my diploma thesis, but I =
encountered a problem, when I wanted to read image data in C =
language.<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US>I =
have tiff image exported from GDAL:<o:p></o:p></span></p><p =
class=3DMsoNormal><a =
href=3D"https://www.dropbox.com/s/r6p1j06gg7a1vh2/BK4_10_rad_Export_line_=
2.tif">https://www.dropbox.com/s/r6p1j06gg7a1vh2/BK4_10_rad_Export_line_2=
.tif</a><o:p></o:p></p><p class=3DMsoNormal>(histogram <span =
lang=3DEN-US>stretch is needed for good view (e.g. using =
QGIS)</span>)<o:p></o:p></p><p class=3DMsoNormal><span =
lang=3DEN-US>which is composed of three channels (RGB). Original GDAL =
data file was composed of 65 channels, but I GDALRasterIO-ed it into =
RGB.<o:p></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US>Now =
I&#8217;d like to read this tiff file using methods from libtiff webpage =
(<a =
href=3D"http://www.remotesensing.org/libtiff/libtiff.html#tiffrgbaimage">=
http://www.remotesensing.org/libtiff/libtiff.html#tiffrgbaimage</a>),<o:p=
></o:p></span></p><p class=3DMsoNormal><span lang=3DEN-US>but when =
I&#8217;m using </span><span lang=3DEN-US>&nbsp;</span>either the<span =
lang=3DEN-US> first or the second method (i.e. </span><tt><span =
style=3D'font-size:10.0pt'>TIFFReadRGBAImage</span></tt><span =
lang=3DEN-US> or </span><tt><span =
style=3D'font-size:10.0pt'>TIFFRGBAImageBegin/TIFFRGBAImageGet/TIFFRGBAIm=
ageEnd)<o:p></o:p></span></tt></p><p class=3DMsoNormal><span =
lang=3DEN-US>I&#8217;m still facing the same problem during debugging in =
VS2012<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>(Unhandled exception at 0x6FDB01C0 (libtiff3.dll) in =
ConsoleApplication1.exe: 0xC0000005: Access violation reading location =
0x0105C001.).<o:p></o:p></span></p><p class=3DMsoNormal><span =
lang=3DEN-US>Here is part of my C code:<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:wh=
ite;mso-highlight:white'>TIFF</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>* tif_load;<o:p></o:p></span></p><p =
class=3DMsoNormal style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:wh=
ite;mso-highlight:white'>uint32</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'> w, h;<o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:wh=
ite;mso-highlight:white'>size_t</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'> npixels;<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:wh=
ite;mso-highlight:white'>uint32</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>* raster;</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></s=
pan></p><p class=3DMsoNormal><span =
lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>tif_load =3D TIFFOpen(</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#A31515;background:wh=
ite;mso-highlight:white'>&quot;C:/&#8230;/BK4_10_rad_Export_line_2.tif&qu=
ot;</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>, </span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#A31515;background:wh=
ite;mso-highlight:white'>&quot;r&quot;</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>);</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></s=
pan></p><p class=3DMsoNormal style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal =
style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>TIFFGetField(tif_load, </span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#6F008A;background:wh=
ite;mso-highlight:white'>TIFFTAG_IMAGEWIDTH</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>, &amp;w);<o:p></o:p></span></p><p =
class=3DMsoNormal><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>TIFFGetField(tif_load, </span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#6F008A;background:wh=
ite;mso-highlight:white'>TIFFTAG_IMAGELENGTH</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>, &amp;h);</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black'><o:p></o:p></s=
pan></p><p class=3DMsoNormal style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal =
style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>npixels =3D w * h;<o:p></o:p></span></p><p =
class=3DMsoNormal style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>raster =3D (</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:wh=
ite;mso-highlight:white'>uint32</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>*) _TIFFmalloc(npixels*</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:blue;background:white=
;mso-highlight:white'>sizeof</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>(</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:#2B91AF;background:wh=
ite;mso-highlight:white'>uint32</span><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>));<o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>TIFFReadRGBAImage(tif_load, w, h, raster, =
0);<o:p></o:p></span></p><p class=3DMsoNormal =
style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal =
style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>//working with =
raster&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <o:p></o:p></span></p><p =
class=3DMsoNormal style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'><o:p>&nbsp;</o:p></span></p><p class=3DMsoNormal =
style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>_TIFFfree(raster);<o:p></o:p></span></p><p =
class=3DMsoNormal style=3D'text-autospace:none'><span =
style=3D'font-size:9.5pt;font-family:Consolas;color:black;background:whit=
e;mso-highlight:white'>TIFFClose(tif_load);<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>I really don&#8217;t know where is =
that issue, so I hope someone will help me.<o:p></o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US><o:p>&nbsp;</o:p></span></p><p =
class=3DMsoNormal><span lang=3DEN-US>Thank you in advance and sorry for =
my English.<o:p></o:p></span></p><p =
class=3DMsoNormal><o:p>&nbsp;</o:p></p><p class=3DMsoNormal>Best <span =
lang=3DEN-US>regards</span>, Josef =
Olah<o:p></o:p></p></div></body></html>
------=_NextPart_000_0004_01CEC41E.2C004040--


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