Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#5619 closed defect (fixed)

Cannot remove TIFFTAGs

Reported by: afritzler Owned by: Even Rouault
Priority: normal Milestone: 1.11.1
Component: GDAL_Raster Version: unspecified
Severity: normal Keywords: gtiff tag


If I have an image that gdalinfo says this about:

  TIFFTAG_SOFTWARE=GraphicsMagick 1.3.12 2010-03-08 Q8 

I'd like to delete those two tags entirely from the TIFF.

import gdal
ds = gdal.Open('x.tif', gdal.GA_Update)
# this does nothing
# nor does this
ds.SetMetadataItem('TIFFTAG_SOFTWARE', None)
# this does what you'd expect, sets value to an empty string
ds.SetMetadataItem('TIFFTAG_SOFTWARE', '')

I'd prefer the tags be removed entirely from the file, not just set to empty.

Change History (3)

comment:1 Changed 7 years ago by Even Rouault

Component: defaultGDAL_Raster
Keywords: gtiff tag added
Owner: changed from warmerdam to Even Rouault

comment:2 Changed 7 years ago by Even Rouault

Milestone: 1.11.1
Resolution: fixed
Status: newclosed

Note that the following fix does not "securely" erase previously written values as the TIFF directory gets rewritten at the end of the file, and not in-place. So by examining the content of the file with an hexadecimal editor it is generally possible to recover the values that are going to be unset.

trunk r27590, branches/1.11 r27591 "GTiff: allow unsetting TIFFTAG_SOFTWARE, TIFFTAG_DOCUMENTNAME, etc... by removing them from metadata list or passing None as a value of SetMetadataItem?() (#5619)"

comment:3 Changed 7 years ago by Even Rouault

Note: the comment of r27596 wrongly points to that ticket instead of #5616.

Note: See TracTickets for help on using tickets.