Return-Path: <awaresystems.be+caf_=filtered=awaresystems.be@gmail.com>
Delivered-To: filtered@awaresystems.be
Received: from mx-z.one.com (mx-z.one.com [195.47.247.151])
	by mail6.local (Postfix) with ESMTP id C650D3001952C6
	for <filtered@awaresystems.be>; Fri, 23 May 2014 02:21:26 +0000 (UTC)
X-Virus-Scanned: by one.com
X-Amavis-Alert: BAD HEADER SECTION, Duplicate header field: "MIME-Version"
Received-SPF: pass (mx-z: domain of awaresystems.be+caf_=filtered=awaresystems.be@gmail.com designates 209.85.216.181 as permitted sender)
X-Greylist: whitelisted by SQLgrey-1.8.0-rc2
Received: from mail-qc0-f181.google.com (mail-qc0-f181.google.com [209.85.216.181])
	by mx-z.one.com (Postfix) with ESMTP id 67CCF2364B492
	for <filtered@awaresystems.be>; Fri, 23 May 2014 02:21:26 +0000 (UTC)
Received: by mail-qc0-f181.google.com with SMTP id m20so7081946qcx.12
        for <filtered@awaresystems.be>; Thu, 22 May 2014 19:21:25 -0700 (PDT)
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20130820;
        h=x-original-authentication-results:delivered-to:delivered-to
         :mime-version:in-reply-to:references:from:date:message-id:to:cc
         :subject:precedence:list-id:list-unsubscribe:list-archive:list-post
         :list-help:list-subscribe:content-type:mime-version:sender:errors-to;
        bh=5zG/vEnFeJU7TNRS6/2ZuSAAaqHJ/RemBiLsgXq7DNY=;
        b=HE6ieQOuzdfY7GyTGHwe5IHaRNfrwpwy/jrR+gq1HCgzMA6Z4t0ElRuEY5dNKFbleX
         VcfkYbXkd7vyDiacXqblbfMEVQNUvvYNBtMB6fedeDUa4o+sMNbKJsAmdBG5qc4k/jme
         MaBJwx4NPH+APOazJCVhhLbWNNA6xRBLnh7gRn+pJCScyiDtRZALXnDFGxJPPidiLzjy
         amazuOlgBa4bzJXL7udTWEPVcBami5qr7QWNZKBsoFMgo9/5846uDjUR0lx8LGU+0cFj
         4n2KAf6l1hZGbfv15o/ikcjK1KJSO8eh2aIktGjB3zv2nq2DjGdBFNh0Vvm/GgavWhEg
         YbDA==
X-Original-Authentication-Results: mx.google.com;       spf=neutral (google.com: tiff-bounces@lists.maptools.org does not designate permitted sender hosts) smtp.mail=tiff-bounces@lists.maptools.org
X-Received: by 10.224.92.197 with SMTP id s5mr2086792qam.93.1400811685377;
        Thu, 22 May 2014 19:21:25 -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.96.12.71 with SMTP id w7csp242824qdb;
        Thu, 22 May 2014 19:21:24 -0700 (PDT)
X-Received: by 10.224.166.73 with SMTP id l9mr2413857qay.34.1400811683542;
        Thu, 22 May 2014 19:21:23 -0700 (PDT)
Authentication-Results: mx.google.com;
       spf=neutral (google.com: tiff-bounces@lists.maptools.org does not designate permitted sender hosts) smtp.mail=tiff-bounces@lists.maptools.org
Received-SPF: none (google.com: tiff-bounces@lists.maptools.org does not designate permitted sender hosts) client-ip=91.198.169.248;
Received: by 10.229.165.145 with POP3 id i17mf3433814qcy.18;
        Thu, 22 May 2014 19:21:23 -0700 (PDT)
X-Gmail-Fetch-Info: info@awaresystems.be 1 pop.awaresystems.be 110 info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-q.one.com (mx-q.one.com [91.198.169.248])
	by mail6.local (Postfix) with ESMTP id 7B5C63001958EE
	for <info@awaresystems.be>; Fri, 23 May 2014 01:40:25 +0000 (UTC)
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 mx-q.one.com (Postfix) with ESMTP id 35241B5A3B
	for <info@awaresystems.be>; Fri, 23 May 2014 01:40:25 +0000 (UTC)
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 37E5235C02C;
	Thu, 22 May 2014 20:39:42 -0500 (EST)
Received: from mail-oa0-f48.google.com (mail-oa0-f48.google.com
	[209.85.219.48])
	by lists.maptools.org (Postfix) with ESMTPS id E399835C02C
	for <tiff@lists.maptools.org>; Thu, 22 May 2014 20:39:04 -0500 (EST)
Received: by mail-oa0-f48.google.com with SMTP id i4so4906594oah.35
	for <tiff@lists.maptools.org>; Thu, 22 May 2014 18:39:04 -0700 (PDT)
X-Received: by 10.60.146.167 with SMTP id td7mr583565oeb.6.1400809143924; Thu,
	22 May 2014 18:39:03 -0700 (PDT)
MIME-Version: 1.0
Received: by 10.76.93.242 with HTTP; Thu, 22 May 2014 18:38:43 -0700 (PDT)
In-Reply-To: <55312.99.237.207.178.1398315370.squirrel@www.sidefx.com>
References: <CA+dQZa=4eUTTNpfOdEx2oiv3aXBKaCUJQbhcjm9mQ_d4zaxs5w@mail.gmail.com>
	<55312.99.237.207.178.1398315370.squirrel@www.sidefx.com>
From: Chia-Kai Liang <liangck@gmail.com>
Date: Thu, 22 May 2014 18:38:43 -0700
Message-ID: <CA+dQZa=aYYjWEGgHwPgaAam+_umms3tkf4-X2j0CRXqU=U08VQ@mail.gmail.com>
To: Edward Lam <edward@sidefx.com>
Cc: tiff@lists.maptools.org
Subject: Re: [Tiff] Custom EXIF write does not work for stream writer
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="===============0881939404=="
Mime-version: 1.0
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

--===============0881939404==
Content-Type: multipart/alternative; boundary=047d7b5d376c6bfdf304fa074b59

--047d7b5d376c6bfdf304fa074b59
Content-Type: text/plain; charset=UTF-8

I found the problem is that the _tiffosReadProc (in tif_stream.cxx) is not
implemented (libtiff4.0.4) so TIFFFetchDirectory would fail. It seems
strange as that TIFFSetDirectory is required for writing but the help
function is not implemented.

In my own implementation, I try to read when the stream can be casted to
iostream, which works well.

Chia-Kai Liang


On Wed, Apr 23, 2014 at 9:56 PM, Edward Lam <edward@sidefx.com> wrote:

> On Tue, April 22, 2014 22:13, Chia-Kai Liang wrote:
> > I tried to use the  EXIF directory read/write as described in
> > http://www.asmail.be/msg0055060707.html, and find it would fail for
> > stringstream
> >
> > If I replace
> >
> >    tif = TIFFOpen(filename, "w+");
> >
> > in the example code to
> >
> >     std::stringstream buf_stream;
> >
> >     tif = TIFFStreamOpen("MemTIFF", (std::ostream*)&buf_stream);
> >
> > I would get the following error at TIFFSetDirectory(tif, 0):
> >
> > TIFFFetchDirectory: MemTIFF: Can not read TIFF directory count.
> > TIFFReadDirectory: Failed to read directory at offset 22688648.
>
> Does using ostringstream instead of stringstream make a difference?
>
> -Edward
>
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/
>

--047d7b5d376c6bfdf304fa074b59
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I found the problem is that the=C2=A0_tiffosReadProc (in t=
if_stream.cxx) is not implemented (libtiff4.0.4) so=C2=A0TIFFFetchDirectory=
 would fail. It seems strange as that=C2=A0<span style=3D"font-family:arial=
,sans-serif;font-size:12.666666984558105px">TIFFSetDirectory is required fo=
r writing but the help function is not implemented.</span><div>

<span style=3D"font-family:arial,sans-serif;font-size:12.666666984558105px"=
><br></span></div><div><span style=3D"font-family:arial,sans-serif;font-siz=
e:12.666666984558105px">In my own implementation, I try to read when the st=
ream can be casted to iostream, which works well.</span></div>

</div><div class=3D"gmail_extra"><br clear=3D"all"><div>Chia-Kai Liang</div=
>
<br><br><div class=3D"gmail_quote">On Wed, Apr 23, 2014 at 9:56 PM, Edward =
Lam <span dir=3D"ltr">&lt;<a href=3D"mailto:edward@sidefx.com" target=3D"_b=
lank">edward@sidefx.com</a>&gt;</span> wrote:<br><blockquote class=3D"gmail=
_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:=
1ex">

<div class=3D"">On Tue, April 22, 2014 22:13, Chia-Kai Liang wrote:<br>
&gt; I tried to use the =C2=A0EXIF directory read/write as described in<br>
&gt; <a href=3D"http://www.asmail.be/msg0055060707.html" target=3D"_blank">=
http://www.asmail.be/msg0055060707.html</a>, and find it would fail for<br>
&gt; stringstream<br>
&gt;<br>
&gt; If I replace<br>
&gt;<br>
&gt; =C2=A0 =C2=A0tif =3D TIFFOpen(filename, &quot;w+&quot;);<br>
&gt;<br>
&gt; in the example code to<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 std::stringstream buf_stream;<br>
&gt;<br>
&gt; =C2=A0 =C2=A0 tif =3D TIFFStreamOpen(&quot;MemTIFF&quot;, (std::ostrea=
m*)&amp;buf_stream);<br>
&gt;<br>
&gt; I would get the following error at TIFFSetDirectory(tif, 0):<br>
&gt;<br>
&gt; TIFFFetchDirectory: MemTIFF: Can not read TIFF directory count.<br>
&gt; TIFFReadDirectory: Failed to read directory at offset 22688648.<br>
<br>
</div>Does using ostringstream instead of stringstream make a difference?<b=
r>
<br>
-Edward<br>
<br>
_______________________________________________<br>
Tiff mailing list: <a href=3D"mailto:Tiff@lists.maptools.org">Tiff@lists.ma=
ptools.org</a><br>
<a href=3D"http://lists.maptools.org/mailman/listinfo/tiff" target=3D"_blan=
k">http://lists.maptools.org/mailman/listinfo/tiff</a><br>
<a href=3D"http://www.remotesensing.org/libtiff/" target=3D"_blank">http://=
www.remotesensing.org/libtiff/</a><br>
</blockquote></div><br></div>

--047d7b5d376c6bfdf304fa074b59--

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