AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2006.09.27 10:01 "[Tiff] help", by Robert Scheck
2006.09.26 14:22 "[Tiff] 2003.08.07 16:40 "Custom tags", by Andrey Kiselev", by Robert Scheck
2006.10.11 10:21 "Re: [Tiff] Handling Of SubIFD in Libtiff Ver 3.8.3", by Sebastian Boehmer
2006.10.12 13:01 "Re: [Tiff] Handling Of SubIFD in Libtiff Ver 3.8.3", by Anurag Singh
2006.10.12 13:41 "Re: [Tiff] Handling Of SubIFD in Libtiff Ver 3.8.3", by =?iso-8859-15?Q?Sebastian_B=F6hmer?=
2006.10.13 05:16 "Re: [Tiff] Handling Of SubIFD in Libtiff Ver 3.8.3", by Anurag Singh
2006.10.14 12:58 "Re: [Tiff] Handling Of SubIFD in Libtiff Ver 3.8.3", by Anurag Singh
2006.10.16 19:35 "Re: [Tiff] Handling Of SubIFD in Libtiff Ver 3.8.3", by Sebastian Boehmer
2006.09.27 12:43 "Re: [Tiff] help", by Joris
2006.09.27 13:26 "Re: [Tiff] help", by Gerben Vos
2006.09.27 13:47 "Re: [Tiff] help", by Joris

2006.09.27 10:01 "[Tiff] help", by Robert Scheck

I'm using LiffTib Version 3.8.2 for Windows.

I try to make a simple copy of 'in.tif'. It's a Jpg-In-Tiff File.

In the output file there are new tags:

  JPEGTables (347) UNDEFINED (7) 2000<00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 ...>
  YCbCrSubsampling (530) SHORT (3) 2<2 2>

The tag JPEGTables seems to be corrupt. If I delete this tag, the image

can be shown with standard viewers.

What is the reason for the new tags? Can I avoid this tags?

Here is the simple code:

#include <windows.h>
#include "tiffio.h"

#define CopyField(tag, v) \
    if (TIFFGetField(pIn, tag, &v)) TIFFSetField(pOut, tag, v)

int main(int argc, char* argv[])
{

  int     rc  = 0;
  int     stripsize;
  uint16  bitspersample, samplesperpixel, rowsperstrip, compression, 

fotometric;

  uint16  fillorder, resunit, orientation, config;
  uint32  width, length, subfiletype, jpgTb1, * count;
  float   xres, yres;
  void *  tables;
  tdata_t array = NULL;
  tsize_t size  = 100000;
  TIFF *  pIn;
  TIFF *  pOut;

  pIn = TIFFOpen ("in.tif", "r");
  pOut = TIFFOpen ("out.tif", "w");

     CopyField  (TIFFTAG_SUBFILETYPE      , subfiletype);
     CopyField  (TIFFTAG_IMAGEWIDTH       , width);
     CopyField  (TIFFTAG_IMAGELENGTH      , length);
     CopyField  (TIFFTAG_BITSPERSAMPLE    , bitspersample);
     CopyField  (TIFFTAG_COMPRESSION      , compression);
     CopyField  (TIFFTAG_PHOTOMETRIC      , fotometric);
     CopyField  (TIFFTAG_SAMPLESPERPIXEL  , samplesperpixel);
     CopyField  (TIFFTAG_ROWSPERSTRIP     , rowsperstrip);
     CopyField  (TIFFTAG_XRESOLUTION      , xres);
     CopyField  (TIFFTAG_YRESOLUTION      , yres);
     CopyField  (TIFFTAG_PLANARCONFIG     , config);
     CopyField  (TIFFTAG_RESOLUTIONUNIT   , resunit);

  array = new char [size];

  stripsize = read_strip (pIn, array, size);
  write_strip (pOut, array, stripsize);

  TIFFClose (pIn);
  TIFFClose (pOut);

  return 0;
}

static int read_strip (TIFF *tif, const tdata_t array, const tsize_t size)
{
  tsize_t stripsize;
  tdata_t buf = NULL;

  stripsize = TIFFRawStripSize (tif, 0);

  buf = _TIFFmalloc (stripsize);

  if (TIFFReadRawStrip (tif, 0, buf, stripsize) != stripsize)
    return -1;

  memcpy (array, buf, stripsize);

  _TIFFfree (buf);

  return stripsize;
}

static int write_strip (TIFF *tif, const tdata_t array, const tsize_t
size)
{
  if (TIFFWriteRawStrip (tif, 0, array, size) != size)
    return -1;

  return 0;
}

Regards

Robert Scheck
Senior Software Engineer
----------------------------------------
Beta Systems Software AG
Business Line ECM
Hübnerstraße 3, D-86150 Augsburg
Phone +49 (0) 821 - 7941 - 215
Fax +49 (0) 821 - 7941 - 353
Email: robert.scheck@betasystems.com
http://www.betasystems.com

[This message is confidential. It may also be privileged or otherwise protected by work product immunity or other legal rules. If you have received it by mistake please let us know by reply and then delete it from your system; you should not copy it or disclose its contents to anyone. All messages sent to and from Beta Systems may be monitored to ensure compliance with internal policies and to protect our business. Emails are not secure and cannot be guaranteed to be error free as they can be intercepted, amended, lost or destroyed, or contain viruses. Anyone who communicates with us by email is taken to accept these risks.]