Return-Path: <tiff-bounces@lists.maptools.org>
X-Original-To: info@awaresystems.be
Delivered-To: info@awaresystems.be
Received: from mx-l.b-one.net (mx-l.one.com [91.198.169.59])
	by mail9.b-one.net (Postfix) with ESMTP id 61D15400408
	for <info@awaresystems.be>; Mon, 19 Oct 2009 11:13:45 +0200 (CEST)
X-Virus-Scanned: by one.com
X-Spam-Score: 0
X-Spam-Level: 
X-Spam-Status: No, score=0 tagged_above=0 required=6 tests=[none]
X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4
Received: from lists.maptools.org (lists.maptools.org [65.39.174.144])
	by mx-l.b-one.net (Postfix) with ESMTP id 61E421CA8629
	for <info@awaresystems.be>; Mon, 19 Oct 2009 11:13:44 +0200 (CEST)
Received: from localhost.localdomain (localhost.localdomain [127.0.0.1])
	by lists.maptools.org (Postfix) with ESMTP id B63991D18B147;
	Mon, 19 Oct 2009 04:10:39 -0500 (EST)
Received: from smtpa.meduniwien.ac.at (manon.srv.meduniwien.ac.at
	[149.148.224.15])
	by lists.maptools.org (Postfix) with ESMTP id 91E461D18B140
	for <tiff@lists.maptools.org>; Mon, 19 Oct 2009 04:05:30 -0500 (EST)
Received: from smtpa.meduniwien.ac.at (localhost [127.0.0.1])
	by smtpa.meduniwien.ac.at (Postfix) with SMTP id D72EC4DD42F
	for <tiff@lists.maptools.org>; Mon, 19 Oct 2009 11:05:24 +0200 (CEST)
Received: from [192.168.1.101] (zron-app.surgery.meduniwien.ac.at
	[149.148.140.41])
	by smtpa.meduniwien.ac.at (Postfix) with ESMTP id C48174DD291
	for <tiff@lists.maptools.org>; Mon, 19 Oct 2009 11:05:24 +0200 (CEST)
Mime-Version: 1.0 (Apple Message framework v1076)
From: "Horvat Johann" <johann.horvat@meduniwien.ac.at>
X-Priority: 3 (Normal)
Resent-From: "Horvat Johann" <johann.horvat@meduniwien.ac.at>
Date: Mon, 19 Oct 2009 00:43:54 +0200 (CEST)
Resent-Date: Mon, 19 Oct 2009 11:05:22 +0200
Resent-To: tiff@lists.maptools.org
Message-Id: <5035_1255943124_4ADC2BD4_5035_2816823_1_728e5bde1054aabd46737810f7a1787a.squirrel@webmail.meduniwien.ac.at>
To: tiff@remotesensing.org
X-Mailer: Apple Mail (2.1076)
Resent-Message-Id: <20091019090524.C48174DD291@smtpa.meduniwien.ac.at>
X-PMX-Version: 5.5.2.365749, Antispam-Engine: 2.6.1.350677,
	Antispam-Data: 2009.10.19.85720
Subject: [Tiff] open/write/close tiff in local buffer instead of using file?
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: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Sender: tiff-bounces@lists.maptools.org
Errors-To: tiff-bounces@lists.maptools.org

Dear TIFF forum members,

Is there any possibility to let the following simple (modified) sample
from http://www.ibm.com/developerworks/linux/library/l-libtiff/ use the
tiffbuffer instead of writing the output.tif to the filesystem?

I'll need this, because I'm trying to write mxf files (single large  
file),
which will contain a sequence of DNG/TIFF images...

Thanks in advance
Johann

--------------------------------------------
#include <stdio.h>
#include <tiffio.h>

int main(int argc, char *argv[]){
  // Define an image
  char buffer[25 * 144] = { /* boring hex omitted */ };

  /* tiff output buffer, somewhat bigger than the original buffer */  
char
tiffbuffer[25*144*2];

  TIFF *image;

  // Open the TIFF file
  if((image = TIFFOpen("output.tif", "w")) == NULL){
    printf("Could not open output.tif for writing\n");
    exit(42);
  }

  // We need to set some values for basic tags before we can add any  
data
TIFFSetField(image, TIFFTAG_IMAGEWIDTH, 25 * 8);
  TIFFSetField(image, TIFFTAG_IMAGELENGTH, 144);
  TIFFSetField(image, TIFFTAG_BITSPERSAMPLE, 1);
  TIFFSetField(image, TIFFTAG_SAMPLESPERPIXEL, 1);
  TIFFSetField(image, TIFFTAG_ROWSPERSTRIP, 144);

  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, 150.0);
  TIFFSetField(image, TIFFTAG_YRESOLUTION, 150.0);
  TIFFSetField(image, TIFFTAG_RESOLUTIONUNIT, RESUNIT_INCH);

  // Write the information to the file
  TIFFWriteEncodedStrip(image, 0, buffer, 25 * 144);

  // Close the file
  TIFFClose(image);
}
--------------------------------------------


_______________________________________________
Tiff mailing list: Tiff@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
