X-Account-Key: account1
X-UIDL: a4fde98c125488eecce90f21fb28b27a
X-Mozilla-Status: 0011
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:                                                                                 
Received: from lists.maptools.org (lothlorien.howardsilvan.com [127.0.0.1])
	by mail.howardsilvan.com (Postfix) with ESMTPS id B0335672199
	for <faxguy@howardsilvan.com>; Sat, 21 Nov 2015 01:04:29 -0800 (PST)
Received: from lists.maptools.org ([94.23.4.142] helo=lists.maptools.org)
	by lothlorien.howardsilvan.com
	with SMTP (2.3.3); 21 Nov 2015	01:04:29 -0800
Received: from [10.1.0.241] (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id 788D735C044;
	Sat, 21 Nov 2015 04:03:38 -0500 (EST)
Received: from mail-io0-f170.google.com (mail-io0-f170.google.com	[209.85.223.170])
	by lists.maptools.org (Postfix) with ESMTPS id 4FAB235C02E
	for <tiff@lists.maptools.org>; Sat, 21 Nov 2015 04:00:38 -0500 (EST)
Received: by ioc74 with SMTP id 74so146007762ioc.2
	for <tiff@lists.maptools.org>; Sat, 21 Nov 2015 01:00:37 -0800 (PST)
MIME-Version: 1.0
X-Received: by 10.107.164.24 with SMTP id n24mr17856663ioe.21.1448096437826;
	Sat, 21 Nov 2015 01:00:37 -0800 (PST)
Received: by 10.36.30.197 with HTTP; Sat, 21 Nov 2015 01:00:37 -0800 (PST)
In-Reply-To: 
 <CAGNS0RvXoPWrxOyKhpW4Viy+0123RbbsTbaJb9gQ+4HHcrR+XA@mail.gmail.com>
References:
	<CA+OdjRy0YeoQuBvAwYud91HFo5bDEW7YUkrN2R-3Y0SzC34H9g@mail.gmail.com>
	<CAGNS0RvXoPWrxOyKhpW4Viy+0123RbbsTbaJb9gQ+4HHcrR+XA@mail.gmail.com>
Date: Sat, 21 Nov 2015 10:00:37 +0100
Message-ID: <CA+OdjRwp34Gr4F7q0aaNWGX5Jdm1iAWt7pnsd3n1msc18VHH=g@mail.gmail.com>
From: xb1 xbv1 <xb1mydealz@gmail.com>
To: jcupitt@gmail.com
Cc: TIFF <tiff@lists.maptools.org>
Subject: Re: [Tiff] Write 32bit Float data to Tiff (Libtiff)
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>
Mime-version: 1.0
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-Assp-ID: lothlorien.howardsilvan.com m1-96669-03940
X-Assp-Session: 7FE09F40B088 (mail 1)
X-Assp-Detected-RIP: 209.85.223.170
X-Assp-Source-IP: 209.85.223.170
X-Assp-Envelope-From: tiff-bounces@lists.maptools.org
X-Assp-Intended-For: faxguy@howardsilvan.com
X-Assp-Version: 2.3.3(14029) on lothlorien.howardsilvan.com
X-Assp-Server-TLS: yes
X-Assp-Delay: not delayed (whitelisted); 21 Nov 2015 01:04:29 -0800
X-Assp-Whitelisted: Yes (whitelistdb)
Return-Path: tiff-bounces@lists.maptools.org
Content-Type: multipart/mixed;
	boundary="===============1721998828=="


--===============1721998828==
Content-Type: multipart/alternative; boundary=001a1141bc5cc6fcc5052509392a


--001a1141bc5cc6fcc5052509392a
Content-Type: text/plain; charset=UTF-8

Thanks a lot. i am using the libtiff.net library for the c#. so the code
was a bit different but it worked :)

now i am trying to add a new custom tag to the header (like in the example
here: https://bitmiracle.github.io/libtiff.net/).

it worked great for this tag (ASCII Data):
http://www.awaresystems.be/imaging/tiff/tifftags/gdal_nodata.html
but it wont work for this (Double-Data):
http://www.awaresystems.be/imaging/tiff/tifftags/modelpixelscaletag.html

i tried it for the second one with TiffType.Double and a double array with
3 values but after looking at the tags with gdalinfo.exe it wont show up -
>any idea what i am doing wrong?

2015-11-20 15:31 GMT+01:00 <jcupitt@gmail.com>:

> On 20 November 2015 at 14:09, xb1 xbv1 <xb1mydealz@gmail.com> wrote:
> > now i am trying to write the float data (stored in an float-array) via
> > WriteScanLine into the tif file, but WriteScanLine just supports
> byte-arrays
> > which only stores 8bit integers.
> >
> > what do i have to do, to save float to tif?
>
> You can write all kinds of data to tiff, the type is set at runtime by
> the tags you attach to the header.
>
> When you call the write function, you cast your typed data down to to
> a byte array to be packed off to the output. For example:
>
> float *line_buffer = (float *) calloc(100, sizeof(float));
> int i;
>
> for (i = 0; i < 100; i++)
>   line_buffer[i] = sin(2 * M_PI * i / 100);
>
> TIFFWriteScanline(tif, (uchar *) line_buffer, 0, 0);
>
> And TIFFWriteScanline() will figure out how many bytes to write by
> looking at your tiff header.
>
> John
>

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

<div dir=3D"ltr">Thanks a lot. i am using the <a href=3D"http://libtiff.net=
">libtiff.net</a> library for the c#. so the code was a bit different but i=
t worked :)<div><br></div><div>now i am trying to add a new custom tag to t=
he header (like in the example here:=C2=A0<a href=3D"https://bitmiracle.git=
hub.io/libtiff.net/">https://bitmiracle.github.io/libtiff.net/</a>).=C2=A0<=
div><br></div><div>it worked great for this tag (ASCII Data):=C2=A0<a href=
=3D"http://www.awaresystems.be/imaging/tiff/tifftags/gdal_nodata.html">http=
://www.awaresystems.be/imaging/tiff/tifftags/gdal_nodata.html</a></div><div=
>but it wont work for this (Double-Data):=C2=A0<a href=3D"http://www.awares=
ystems.be/imaging/tiff/tifftags/modelpixelscaletag.html">http://www.awaresy=
stems.be/imaging/tiff/tifftags/modelpixelscaletag.html</a></div><div><br></=
div><div>i tried it for the second one with TiffType.Double and a double ar=
ray with 3 values but after looking at the tags with gdalinfo.exe it wont s=
how up - &gt;any idea what i am doing wrong?=C2=A0</div></div></div><div cl=
ass=3D"gmail_extra"><br><div class=3D"gmail_quote">2015-11-20 15:31 GMT+01:=
00  <span dir=3D"ltr">&lt;<a href=3D"mailto:jcupitt@gmail.com" target=3D"_b=
lank">jcupitt@gmail.com</a>&gt;</span>:<br><blockquote class=3D"gmail_quote=
" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><=
span class=3D"">On 20 November 2015 at 14:09, xb1 xbv1 &lt;<a href=3D"mailt=
o:xb1mydealz@gmail.com">xb1mydealz@gmail.com</a>&gt; wrote:<br>
&gt; now i am trying to write the float data (stored in an float-array) via=
<br>
&gt; WriteScanLine into the tif file, but WriteScanLine just supports byte-=
arrays<br>
&gt; which only stores 8bit integers.<br>
&gt;<br>
&gt; what do i have to do, to save float to tif?<br>
<br>
</span>You can write all kinds of data to tiff, the type is set at runtime =
by<br>
the tags you attach to the header.<br>
<br>
When you call the write function, you cast your typed data down to to<br>
a byte array to be packed off to the output. For example:<br>
<br>
float *line_buffer =3D (float *) calloc(100, sizeof(float));<br>
int i;<br>
<br>
for (i =3D 0; i &lt; 100; i++)<br>
=C2=A0 line_buffer[i] =3D sin(2 * M_PI * i / 100);<br>
<br>
TIFFWriteScanline(tif, (uchar *) line_buffer, 0, 0);<br>
<br>
And TIFFWriteScanline() will figure out how many bytes to write by<br>
looking at your tiff header.<br>
<br>
John<br>
</blockquote></div><br></div>

--001a1141bc5cc6fcc5052509392a--

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


