Received: from mailgate002.isp.belgacom.be (mailgate002.isp.belgacom.be [195.238.6.87])
	by maildelivery019.isp.belgacom.be (Postfix) with ESMTP id CE35F84087
	for <joris.at.lebbeke@skynet.be>; Thu, 15 Nov 2007 16:20:28 +0100 (CET)
Received: from r153.dmsolutions.ca (HELO duke.maptools.org) ([209.217.116.153])
  by in.mx.skynet.be with ESMTP; 15 Nov 2007 16:20:27 +0100
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 lAFEgVBL009962;
	Thu, 15 Nov 2007 09:43:49 -0500
Received: from terra.csc.depauw.edu ([163.120.18.36])
	by duke.maptools.org (8.12.11/8.12.10) with ESMTP id lAFEg3EZ009954
	for <tiff@lists.maptools.org>; Thu, 15 Nov 2007 09:42:03 -0500
Received: from [163.120.18.135] ([163.120.18.135])
	by terra.csc.depauw.edu (8.13.8/8.13.8) with ESMTP id lAFEfvXY010830;
	Thu, 15 Nov 2007 09:42:00 -0500
Message-ID: <473C5ABC.9040504@depauw.edu>
Date: Thu, 15 Nov 2007 09:42:04 -0500
From: Ron Croonenberg <ronc@depauw.edu>
Organization: DePauw University
User-Agent: Thunderbird 1.5.0.13 (Windows/20070809)
MIME-Version: 1.0
To: Jason Tillett <jasonpop@netsup.net>
Subject: Re: [Tiff] Simple code to write Tiff images from Raw data
References: <9D486A94DB504C67AE48FC3E4C866275@jctx64>
In-Reply-To: <9D486A94DB504C67AE48FC3E4C866275@jctx64>
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit
Cc: libtiff <tiff@lists.maptools.org>
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>
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org
X-UIDL: 000000000023ceae.000028eb
X-MSP-STORE: Thu, 15 Nov 2007 16:20:29 +0100
Status:   

Hello Jason,

I am very new to using libTiff, I bearly know what I am doing really. 
The thing is that someone was really friendly and gave me a code snippet 
  that I use to create tiff files.

Someone on the list suggested to create a tiffinfo report. (As soon as I 
figured out how to do that I'll post one)

this is what I have/use for creating tiffs:

TIFFSetField (tif, TIFFTAG_IMAGEWIDTH,  horiz);
TIFFSetField (tif, TIFFTAG_IMAGELENGTH, vertic);
TIFFSetField (tif, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
TIFFSetField (tif, TIFFTAG_SAMPLESPERPIXEL,  3);
TIFFSetField (tif, TIFFTAG_BITSPERSAMPLE,    8);
TIFFSetField (tif, TIFFTAG_EXTRASAMPLES,     0, NULL);
TIFFSetField (tif, TIFFTAG_ORIENTATION,      ORIENTATION_TOPLEFT);
TIFFSetField (tif, TIFFTAG_PHOTOMETRIC,      PHOTOMETRIC_RGB);
TIFFSetField (tif, TIFFTAG_IMAGEDESCRIPTION, "Cluster computing");
TIFFSetField (tif, TIFFTAG_COMPRESSION,      COMPRESSION_DEFLATE);
TIFFSetField (tif, TIFFTAG_PREDICTOR,        1 /* experiment */);
TIFFSetField (tif, TIFFTAG_ROWSPERSTRIP,     16);


thanks,

Ron



Jason Tillett wrote:
> Here is my simple code snippet.
> I have not had any compatibility problems
> but maybe I just got lucky so far...
> 
> TIFF *out=TIFFOpen(fn,"w");
> int width=nx;int height=ny;int sampleperpixel=1; //RGBA=4 bw/gray=1
> TIFFSetField(out, TIFFTAG_IMAGEWIDTH, width);
> TIFFSetField(out, TIFFTAG_IMAGELENGTH, height);
> TIFFSetField(out, TIFFTAG_PLANARCONFIG, PLANARCONFIG_CONTIG);
> TIFFSetField(out, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK);
> TIFFSetField(out, TIFFTAG_BITSPERSAMPLE, 8);
> TIFFSetField(out, TIFFTAG_SAMPLESPERPIXEL, sampleperpixel);
> TIFFSetField(out, TIFFTAG_ROWSPERSTRIP, ny);
> // Write the information to the tiff file
> if(TIFFWriteEncodedStrip(out, 0, a, width * height * sampleperpixel) == 0){
> fprintf(stderr, "Could not write image\n");
> }
> TIFFClose(out);
> 
> _______________________________________________
> Tiff mailing list: Tiff@lists.maptools.org
> http://lists.maptools.org/mailman/listinfo/tiff
> http://www.remotesensing.org/libtiff/

-- 

=================================================================
  Ron Croonenberg                   |
                                    | Phone: 1 765 658 4761
  Lab Instructor &                  | Fax:   1 765 658 4732
          Technology Coordinator    |
                                    |
  Department of Computer Science    | e-mail: ronc@DePauw.edu
  DePauw University                 |
  275 Julian Science & Math Center  |
  602 South College Ave.            |
  Greencastle, IN  46135            |
=================================================================
_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
