Message-ID: 38E24424.A68369CF@ei.dupont.com
To: tiff@olympiakos.com
Subject: Re: Duplicating tiff file
From: Kin Wong <kinwong@ei.dupont.com>
Date: Wed, 29 Mar 2000 12:57:57 -0500
References: <38E1615B.FCF6B8A8@ei.dupont.com> <38E1658E.BC38B8BD@home.com>
Reply-to: wongkw@ieee.org
Sender: owner-tiff@olympiakos.com


Hi,

Yes, I can recreate the header.  I guess my concern is in line with Tom and Klaus's
warning regarding unknown tiff tags, but in a different direction.  I want the new
file to be identical to the original tiff file with the exception that the pixel
data has been filtered by my code.  This way, I am not losing any information that
may be encoded by the original application that created the file that I am
processing.  This way, I am preserving the originating application's tiff file
format.

I will check out tiffcp.c.  This sounds like it has what you all have suggested.  If
this doesn't work for me, then I guess I will just have to write the tiff file in my
own format, however transient that may be.

Thanks for all your replies,

-  Kin

Chris Friesen wrote:

> Kin Wong wrote:
>
> > Now, hopefully someone can help me with this question by steering me to
> > the proper path.  I want to write a general filtering program for some
> > picture processing.  So I would need to read in a tiff file, process it,
> > and write it out to a new tiff file.  The caveat is that I want to
> > preserve the original header in the new tiff file.
>
> Do you need to preserve the exact same header, or can you simply recreate it?
>
> If it can be recreated, then all you need to do is read in all the tags at the
> beginning, then set them to the same value before writing out the new file.  You
> can then use encoded scanline read/write routines.

Bjorn Brox wrote:
> Take a look on tiffcp.c in the tools directory of the libtiff source.


Tom Lane and Klaus Bartz warned:
> The tiffcp tool does that, although its approach is pretty much
> brute-force --- it has to know explicitly about each tag to be
> copied.  OTOH, trying to copy an unknown tag is a dangerous thing
> to do in TIFF; dropping unknowns is arguably the right approach.
> (PNG handles this better...)
>
>                         regards, tom lane
>Hi,
>copy an unknown tag is really a dangerous thing. I have had
>some trouble with it.
...
>Klaus




