Received: from mailgate002.isp.belgacom.be (mailgate002.isp.belgacom.be [195.238.6.87])
	by maildelivery005.isp.belgacom.be (Postfix) with ESMTP id E0EFF164032
	for <joris.at.lebbeke@skynet.be>; Thu, 17 Apr 2008 16:33:21 +0200 (CEST)
Authentication-Results: in.mx.skynet.be; dkim=permerror (body hash did not verify [final] [TEST]) header.i=@gmail.com
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 17 Apr 2008 16:33:21 +0200
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 m3HEJxni005299;
	Thu, 17 Apr 2008 10:20:53 -0400
Received: from fg-out-1718.google.com (fg-out-1718.google.com [72.14.220.154])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id m3HEJumD005288
	for <tiff@lists.maptools.org>; Thu, 17 Apr 2008 10:19:56 -0400
Received: by fg-out-1718.google.com with SMTP id 16so60200fgg.41
	for <tiff@lists.maptools.org>; Thu, 17 Apr 2008 07:19:44 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type;
	bh=y04ZHjiTI3fVJBi3dt7HuMMOuj8T1bAUMjcULeCebCw=;
	b=ZVAJTka4K/dQlUPJJyx4x5p4txMyCnujrSdH+2wvRtFDfRXXNo+Hm20KjCNaC7MZ9EpnFmd+VH2WujISdpoRW6i0me4u7ZYsUhL3RvqK/k097x3zoyu4Elk7+WljxW28XGx6FcMlnObFb35yH/b2mOK5Rv58HQ4OgwNoES+V+JE=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=message-id:date:from:to:subject:mime-version:content-type;
	b=te33urMKsTKd6g06eRFE248Y4h4XpHFIW1ZrDf/c6pFGgp6jX5ftQvxI0G7IRcz34hVpEwmmWecbUhL947kI/VKDyLerVS4Eu2oANekZh4q9PwGlFelgyDI1njR4pa0MwxT8c/7l67JktJ+delERcdABlm+/ytRt/xSetuaR6KQ=
Received: by 10.86.31.18 with SMTP id e18mr2775583fge.68.1208441984125;
	Thu, 17 Apr 2008 07:19:44 -0700 (PDT)
Received: by 10.86.4.3 with HTTP; Thu, 17 Apr 2008 07:19:43 -0700 (PDT)
Message-ID: <9476ba940804170719o2954d23fi4a9a62f463c47414@mail.gmail.com>
Date: Thu, 17 Apr 2008 16:19:43 +0200
From: "Filippo Trimoldi" <filippo.trimoldi@gmail.com>
To: tiff@lists.maptools.org
MIME-Version: 1.0
Subject: [Tiff] Writing TIFF Group-4 file from array byte
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="===============1556644334=="
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.00002bfa
X-MSP-STORE: Thu, 17 Apr 2008 16:32:13 +0200
Status:   

--===============1556644334==
Content-Type: multipart/alternative; 
	boundary="----=_Part_822_24983433.1208441984120"

------=_Part_822_24983433.1208441984120
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

With Java Morena Framework (an Image Acquisition Framework for Java) I've a
ImageConsumer object that give me a byte Array with size equal to
width*height that I need to write in a Tiff group-4 image with LibTiff
through a JNI. In the C side i perform this code with my byte Array:

// Open the TIFF file
  if((image =3D TIFFOpen(<imagePath> "w")) =3D=3D NULL)
  {
    printf("Could not open output.tif for writing\n");
  }

  TIFFSetField(image, TIFFTAG_ARTIST,"Per ora FILIPPO");
  TIFFSetField(image, TIFFTAG_COPYRIGHT,"Per ora =E8 di FILIPPO");
  TIFFSetField(image, TIFFTAG_IMAGEWIDTH, *width);
  TIFFSetField(image, TIFFTAG_IMAGELENGTH, *height);
  TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, 1);
  TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, 1);
  TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, height);

  TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);
  TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);
  TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);
  TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);

  TIFFSetField(image, TIFFTAG_XRESOLUTION, 300.0);
  TIFFSetField(image, TIFFTAG_YRESOLUTION, 300.0);
  TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);

  // Write the information to the file
  TIFFWriteEncodedStrip(image, 0, <array byte that comes from java>,
arraySize);


But the consequent image is wrong. It's seems to be resized on the X axis
but anyway it's wrong.
I noticed that my array that comes from Java it's a simple sequence of 0-1
(probably coming from scanner in this format) of (width*height) lenght.

What i'm doing wrong? Where is my fault?

------=_Part_822_24983433.1208441984120
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

With Java Morena Framework (an Image Acquisition Framework for Java)
I&#39;ve a ImageConsumer object that give me a byte Array with size equal
to width*height that I need to write in a Tiff group-4 image with
LibTiff through a JNI. In the C side i perform this code with my byte
Array:<br>
<br>
// Open the TIFF file<br>
&nbsp; if((image =3D TIFFOpen(&lt;imagePath&gt; &quot;w&quot;)) =3D=3D NULL=
)<br>
&nbsp; {<br>
&nbsp;&nbsp;&nbsp; printf(&quot;Could not open output.tif for writing\n&quo=
t;);<br>
&nbsp; }<br>
<br>
&nbsp; TIFFSetField(image, TIFFTAG_ARTIST,&quot;Per ora FILIPPO&quot;);<br>
&nbsp; TIFFSetField(image, TIFFTAG_COPYRIGHT,&quot;Per ora =E8 di FILIPPO&q=
uot;);<br>
&nbsp; TIFFSetField(image, TIFFTAG_IMAGEWIDTH, *width);<br>
&nbsp; TIFFSetField(image, TIFFTAG_IMAGELENGTH, *height);<br>
&nbsp; TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, 1);<br>
&nbsp; TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, 1);<br>
&nbsp; TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, height);<br>
<br>
&nbsp; TIFFSetField(image, TIFFTAG_COMPRESSION, COMPRESSION_CCITTFAX4);<br>
&nbsp; TIFFSetField(image, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISWHITE);<br=
>
&nbsp; TIFFSetField(image, TIFFTAG_FILLORDER, FILLORDER_MSB2LSB);<br>
&nbsp; TIFFSetField(image, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);<br>
<br>
&nbsp; TIFFSetField(image, TIFFTAG_XRESOLUTION, 300.0);<br>
&nbsp; TIFFSetField(image, TIFFTAG_YRESOLUTION, 300.0);<br>
&nbsp; TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);<br>
&nbsp; <br>
&nbsp; // Write the information to the file<br>
&nbsp; TIFFWriteEncodedStrip(image, 0, &lt;array byte that comes from java&=
gt;, arraySize);<br>
<br>
<br>
But the consequent image is wrong. It&#39;s seems to be resized on the X ax=
is but anyway it&#39;s wrong.<br>
I noticed that my array that comes from Java it&#39;s a simple sequence of
0-1 (probably coming from scanner in this format) of (width*height)
lenght.<br>
<br>
What i&#39;m doing wrong? Where is my fault?

------=_Part_822_24983433.1208441984120--

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