-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
GTiff: save XMP on field TIFFTAG_XMLPACKET #767
GTiff: save XMP on field TIFFTAG_XMLPACKET #767
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add a new test case in autotest/gcore/tiff_write.py testing this ?
gdal/frmts/gtiff/geotiff.cpp
Outdated
@@ -18244,6 +18244,12 @@ CPLErr GTiffDataset::SetMetadata( char ** papszMD, const char *pszDomain ) | |||
} | |||
} | |||
|
|||
if( EQUAL(pszDomain, "xml:XMP") && papszMD && *papszMD ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pszDomain != nullptr should be tested
gdal/frmts/gtiff/geotiff.cpp
Outdated
@@ -18244,6 +18244,12 @@ CPLErr GTiffDataset::SetMetadata( char ** papszMD, const char *pszDomain ) | |||
} | |||
} | |||
|
|||
if( EQUAL(pszDomain, "xml:XMP") && papszMD && *papszMD ) | |||
{ | |||
int nTagSize = strlen(*papszMD) + 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
explicit static_cast should be done.
Are you sure that the nul terminated byte must be written ? I didn't check the specification, but the autotest/gdrivers/data/byte_with_xmp.tif doesn't include a nul terminated byte for example
About the test case, I don't see how can I test it. I do not see how can I access directly to this field in python, not using "GetMetadata". Is there any option? |
OK, so that should also be fixed so that it is written only once in TIFFTAG_XMLPACKET and not in the GDAL TIFF tag. |
What does this PR do?
This PR saves the XMP xml data in the field
TIFFTAG_XMLPACKET
whenGTiffDataset::SetMetadata
is called with the domainxml:XMP
.The method
GTiffDataset::OpenOffset
reads the fieldTIFFTAG_XMLPACKET
and sets the value on the metadata domainxml:XMP
. That gives the user access to the XMP xml string (and read/parse it on their own).However, there is not way to write the XMP data in the field
TIFFTAG_XMLPACKET
. Third party software (like Exiv2) is not able then to read the XMP from a tiff file created with GDAL.What are related issues/pull requests?
None
Tasklist