Discussion:
removing tiff tag in-place
Gennady Khokhorin
2006-12-21 23:54:20 UTC
Permalink
Hi, all.
I have an empty tags which want to remove from tif wout copying process.
I tried TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, ""); but tag still seats in the file.
Is it possible to drop an empty ascii tags?

Gennady Khokhorin
Software Developer,
www.aerometric.com
(907) 272-4495

_______________________________________________
Tiff mailing list: ***@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Andrey Kiselev
2006-12-26 10:30:33 UTC
Permalink
Post by Gennady Khokhorin
I have an empty tags which want to remove from tif wout copying
process. I tried TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, ""); but tag
still seats in the file.
Is it possible to drop an empty ascii tags?
Gennady,

I am afraid there is no a clean way to purge empty tags. I don't want
to recommend you the way with removing old directory using
TIFFUnlinkDirectory() because it involves rewriting the whole data chunk
including strip/tile arrays. You can add an entry to our Bugzilla
requesting the function for field dropping.

Best regards,
Andrey
--
Andrey V. Kiselev
ICQ# 26871517
_______________________________________________
Tiff mailing list: ***@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Gerben Vos
2007-01-02 12:36:46 UTC
Permalink
Post by Gennady Khokhorin
I have an empty tags which want to remove from tif wout copying
process. I tried TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, ""); but tag
still seats in the file. Is it possible to drop an empty ascii tags?
Try TIFFClrFieldBit(tif, FIELD_DOCUMENTNAME), a macro defined in
tif_dir.h . Note: use FIELD_DOCUMENTNAME, not TIFFTAG_DOCUMENTNAME!
I've never used it, but it looks like it does what you want.
I don't think there currently is a public function for this, but I think
it would be a good idea to have one.

Gerben Vos.

_______________________________________________
Tiff mailing list: ***@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Gennady Khokhorin
2007-01-05 05:08:20 UTC
Permalink
Gerben,
I did a bit futher search, following did not work either:

const TIFFFieldInfo* fip = TIFFFindFieldInfo(in, TIFFTAG_DOCUMENTNAME, TIFF_ANY);
TIFFClrFieldBit(in, fip->field_tag);

Output image' empty tags still there.
It could be other ways to make tags cleaning...
Gennady

-----Original Message-----
From: Gennady Khokhorin
Sent: Thursday, January 04, 2007 6:47 PM
To: 'Gerben Vos'
Subject: RE: [Tiff] removing tiff tag in-place


Hi, Gerben.
Can not make it work this way. No any FIELD tag for ascii data in the directory (tif_dir.h).
All text data are marked as FIELD_CUSTOM (tif_dirinfo.c) probably because of variable length.

Was trying to invent those missing fields like that:
{ TIFFTAG_DOCUMENTNAME, -1,-1, TIFF_ASCII, FIELD_DOCUMENTNAME,
1, 0, "DocumentName" },
where #define FIELD_DOCUMENTNAME 50

And did break TIFFTAG<name> - FIELD<name> link, TIFFGetField() can not find documentName field anymore.

I'm going to put a request for this command in bug list.
Happy programming!
Gennady

-----Original Message-----
From: Gerben Vos [mailto:***@ZyLAB.COM]
Sent: Tuesday, January 02, 2007 3:37 AM
To: Gennady Khokhorin
Cc: ***@lists.maptools.org
Subject: Re: [Tiff] removing tiff tag in-place
Post by Gennady Khokhorin
I have an empty tags which want to remove from tif wout copying
process. I tried TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, ""); but tag
still seats in the file. Is it possible to drop an empty ascii tags?
Try TIFFClrFieldBit(tif, FIELD_DOCUMENTNAME), a macro defined in
tif_dir.h . Note: use FIELD_DOCUMENTNAME, not TIFFTAG_DOCUMENTNAME!
I've never used it, but it looks like it does what you want.
I don't think there currently is a public function for this, but I think
it would be a good idea to have one.

Gerben Vos.

_______________________________________________
Tiff mailing list: ***@lists.maptools.org
http://lists.maptools.org/mailman/listinfo/tiff
http://www.remotesensing.org/libtiff/
Gerben Vos
2007-01-08 13:20:25 UTC
Permalink
Gennady,

hmm, I can't find anything about FIELD_CUSTOM in the libtiff sources, but that could be because we still use version 3.5.7 here (sorry everyone!).

That may also mean my other advice doesn't work for newer versions. I'm afraid I don't know enough to help you, nor have the time to research this further.

Anyway, the best route would be a nice clean public function, as already said.

Good luck and happy programming,

Gerben Vos.

-----Original Message-----
From: Gennady Khokhorin [mailto:***@aerometric-ak.com]
Sent: Friday, January 05, 2007 6:08 AM
To: Gerben Vos
Cc: ***@lists.maptools.org
Subject: [SPAM HEADER] - FW: [Tiff] removing tiff tag in-place - Email found in subject

Gerben,
I did a bit futher search, following did not work either:

const TIFFFieldInfo* fip = TIFFFindFieldInfo(in, TIFFTAG_DOCUMENTNAME, TIFF_ANY);
TIFFClrFieldBit(in, fip->field_tag);

Output image' empty tags still there.
It could be other ways to make tags cleaning...
Gennady

-----Original Message-----
From: Gennady Khokhorin
Sent: Thursday, January 04, 2007 6:47 PM
To: 'Gerben Vos'
Subject: RE: [Tiff] removing tiff tag in-place


Hi, Gerben.
Can not make it work this way. No any FIELD tag for ascii data in the directory (tif_dir.h).
All text data are marked as FIELD_CUSTOM (tif_dirinfo.c) probably because of variable length.

Was trying to invent those missing fields like that:
{ TIFFTAG_DOCUMENTNAME, -1,-1, TIFF_ASCII, FIELD_DOCUMENTNAME,
1, 0, "DocumentName" },
where #define FIELD_DOCUMENTNAME 50

And did break TIFFTAG<name> - FIELD<name> link, TIFFGetField() can not find documentName field anymore.

I'm going to put a request for this command in bug list.
Happy programming!
Gennady

-----Original Message-----
From: Gerben Vos [mailto:***@ZyLAB.COM]
Sent: Tuesday, January 02, 2007 3:37 AM
To: Gennady Khokhorin
Cc: ***@lists.maptools.org
Subject: Re: [Tiff] removing tiff tag in-place
Post by Gennady Khokhorin
I have an empty tags which want to remove from tif wout copying
process. I tried TIFFSetField(tif, TIFFTAG_DOCUMENTNAME, ""); but tag
still seats in the file. Is it possible to drop an empty ascii tags?
Try TIFFClrFieldBit(tif, FIELD_DOCUMENTNAME), a macro defined in
tif_dir.h . Note: use FIELD_DOCUMENTNAME, not TIFFTAG_DOCUMENTNAME!
I've never used it, but it looks like it does what you want.
I don't think there currently is a public function for this, but I think
it would be a good idea to have one.

Gerben Vos.

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

Loading...