AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2008.12.17 20:54 "[Tiff] Deleting tags from a directory", by Frank Warmerdam
2008.12.18 04:56 "[Tiff] tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.18 05:31 "Re: [Tiff] tiffvers.h - TIFFLIB_RELEASE macro addition", by Bob Friesenhahn
2008.12.18 06:00 "Re: [Tiff] tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.18 05:13 "Re: [Tiff] tiffvers.h - TIFFLIB_RELEASE macro addition", by Lee Howard
2008.12.18 16:16 "Re: [Tiff] tiffvers.h - TIFFLIB_RELEASE macro addition", by Bob Friesenhahn
2008.12.18 18:59 "Re: [Tiff] tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.18 21:56 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.18 19:04 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Lee Howard
2008.12.18 19:18 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Edward Lam
2008.12.18 19:20 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.18 19:28 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Lee Howard
2008.12.18 19:35 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.18 20:11 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.18 20:42 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Bob Friesenhahn
2008.12.21 15:35 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Jay Berkenbilt
2008.12.21 15:57 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Jay Berkenbilt
2008.12.21 16:14 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.21 16:44 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Jay Berkenbilt
2008.12.18 22:05 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Bob Friesenhahn
2008.12.19 02:26 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Frank Warmerdam
2008.12.19 03:12 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Bob Friesenhahn
2008.12.21 16:03 "Re: [Tiff] 3.9.0 release, Was: tiffvers.h - TIFFLIB_RELEASE macro addition", by Jay Berkenbilt
2008.12.21 16:10 "Re: [Tiff] 3.9.0 release", by Jay Berkenbilt
2009.01.21 04:07 "[Tiff] libtiff 4.0.0beta3", by Frank Warmerdam
2009.01.21 21:11 "Re: [Tiff] libtiff 4.0.0beta3", by Edward Lam
2009.01.22 16:23 "Re: [Tiff] libtiff 4.0.0beta3", by Edward Lam
2009.01.22 16:31 "Re: [Tiff] libtiff 4.0.0beta3", by Bob Friesenhahn
2009.01.22 20:47 "Re: [Tiff] libtiff 4.0.0beta3", by Edward Lam
2009.01.22 20:54 "Re: [Tiff] libtiff 4.0.0beta3", by Frank Warmerdam
2009.01.22 21:09 "Re: [Tiff] libtiff 4.0.0beta3", by Bob Friesenhahn
2009.01.22 21:14 "Re: [Tiff] libtiff 4.0.0beta3", by Frank Warmerdam
2009.01.22 21:20 "Re: [Tiff] libtiff 4.0.0beta3", by Bob Friesenhahn
2009.01.22 21:22 "Re: [Tiff] libtiff 4.0.0beta3", by Edward Lam
2009.01.22 17:00 "Re: [Tiff] libtiff 4.0.0beta3", by Bob Friesenhahn
2009.01.22 19:38 "Re: [Tiff] libtiff 4.0.0beta3", by Frank Warmerdam
2009.01.22 07:15 "[Tiff] Bugzilla not available?", by Rob Eisink
2009.02.05 18:38 "[Tiff] assertions, and building with DEBUG/NDEBUG", by Frank Warmerdam
2009.02.05 19:04 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Edward Lam
2009.02.05 19:13 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Bob Friesenhahn
2009.02.05 19:26 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Frank Warmerdam
2009.02.05 20:00 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Bob Friesenhahn
2009.02.06 04:39 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Phillip Crews
2009.02.06 16:33 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Bob Friesenhahn
2009.02.06 20:34 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Phillip Crews
2009.02.06 12:17 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Ron
2009.02.06 13:57 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Edward Lam
2009.02.06 17:08 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Bob Friesenhahn
2009.02.06 21:05 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Phillip Crews
2009.02.06 10:07 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by
2009.02.06 15:05 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Frank Warmerdam
2009.02.06 10:44 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by
2009.02.06 14:56 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by Frank Warmerdam
2009.02.07 10:53 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by
2009.02.26 22:44 "Re: [Tiff] assertions, and building with DEBUG/NDEBUG", by
2009.02.07 14:10 "Re: [Tiff] The OJPEG bug 1996", by

2008.12.17 20:54 "[Tiff] Deleting tags from a directory", by Frank Warmerdam

Folks,

I have a client who needs to be able to remove a colormap from an existing TIFF file. This reveals a problem that has vexed me a number of times before when trying to update TIFF files "in place". There does not appear to be any mechanism to delete a tag from an existing directory.

I propose, in libtiff4 to add a TIFFUnsetField() function which will remove a tag from the current directory if present. It would be implemented like this:

/*
  * Clear the contents of the field in the internal structure.
  */
int
TIFFUnsetField(TIFF* tif, uint32 tag)
{

     const TIFFField *fip =  TIFFFieldWithTag(tif, tag);
     TIFFDirectory* td = &tif->tif_dir;

     if( !fip )
         return 0;

     if( fip->field_bit != FIELD_CUSTOM )
         TIFFClrFieldBit(tif, fip->field_bit);
     else
     {
         TIFFTagValue *tv;
         int i;

         for (i = 0; i < td->td_customValueCount; i++) {

             tv = td->td_customValues + i;
             if( tv->info->field_tag == tag )
                 break;
         }

         if( i < td->td_customValueCount )
         {
             _TIFFfree(tv->value);
             for( ; i < td->td_customValueCount-1; i++) {
                 td->td_customValues[i] = td->td_customValues[i+1];
             }
             td->td_customValueCount--;
         }
     }

     tif->tif_flags |= TIFF_DIRTYDIRECT;

     return (1);
}

Does anyone know of any problems with this change? Is there already a way for applications to remove tags I'm not aware of? So far, I have only tested the above a wee bit. The following sample program demonstrates turning a paletted file into unpaletted form:

#include "tiffio.h"

int main()

{
     TIFF *hTIFF;

     hTIFF = TIFFOpen( "cm.tif", "r+" );

     if( TIFFSetField( hTIFF, TIFFTAG_PHOTOMETRIC, PHOTOMETRIC_MINISBLACK ) )
         printf( "Set photometric successful.\n" );
     else
         printf( "Set photometric failed.\n" );

     if( TIFFUnsetField( hTIFF, TIFFTAG_COLORMAP ) )
         printf( "clear colormap successful.\n" );
     else
         printf( "clear colormap failed.\n" );

     TIFFClose( hTIFF );
}

Best regards,
--
---------------------------------------+--------------------------------------

I set the clouds in motion - turn up   | Frank Warmerdam, warmerdam@pobox.com
light and sound - activate the windows | http://pobox.com/~warmerdam

and watch the world go round - Rush    | Geospatial Programmer for Rent