AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
October 2009

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2009.10.18 22:43 "open/write/close tiff in local buffer instead of using file?", by Horvat Johann
2009.10.19 16:16 "Re: open/write/close tiff in local buffer instead of using file?", by Bob Friesenhahn
2009.10.19 17:12 "Re: open/write/close tiff in local buffer instead of using file?", by Edward Lam

2009.10.18 22:43 "open/write/close tiff in local buffer instead of using file?", by Horvat Johann

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);
}
--------------------------------------------