[gdal-dev] gdal_translate drops XMP exif tags

Tom O'Reilly oreilly at mbari.org
Mon Aug 8 14:02:05 PDT 2022


Thanks Even and everyone!

As a workaround I think that for each XMP tag=value in the input .jpg, I can specify '-mo tag=value' option to gdal_translate. It appears that those tags/values are embedded and preserved in GDALMetadata through subsequent gdal processing. E.g. I can specify the following options to gdal_translate:

 % gdal_translate -mo Pitch=1.3 -mo Roll=5.5 -mo Yaw=192.1 <other arguments>

Then downstream tools can get Pitch, Roll and Yaw from the GDALMetadata tag.


Thanks
Tom
  

--------------------------------------------------
Thomas C. O'Reilly
Monterey Bay Aquarium Research Institute
7700 Sandholdt Road
Moss Landing, California 95039-9644
831-775-1766 (voice)
831-775-1620 (FAX)
oreilly at mbari.org (email)
http://www.mbari.org (World-wide Web)
 
"The machine does not isolate us from the great mysteries
 of nature, but plunges us more deeply into them."
 
   - ANTOINE DE SAINT-EXUPERY
     "Wind, Sand, and Stars" (1939)

----- Original Message -----
From: "Even Rouault" <even.rouault at spatialys.com>
To: "Tom O'Reilly" <oreilly at mbari.org>
Cc: "gdal-dev" <gdal-dev at lists.osgeo.org>
Sent: Monday, August 8, 2022 1:37:03 PM
Subject: Re: [gdal-dev] gdal_translate drops XMP exif tags

> The geotiff produced by step 1 contains the XMP tags as expected.
> But the warped geotiff produced by step 2 does not contain any XMP tags.

ah ok, gdalwarp indeed does not preserve the XMP information. I guess it 
would be reasonable to do it. You may create an enhancement ticket on 
the GDAL github issue tracker to suggest this.

Even

>
> How best to provide a test jpg? The ones I have are all 20+ MBytes.
>
> Thanks
> Tom
>
> --------------------------------------------------
> Thomas C. O'Reilly
> Monterey Bay Aquarium Research Institute
> 7700 Sandholdt Road
> Moss Landing, California 95039-9644
> 831-775-1766 (voice)
> 831-775-1620 (FAX)
> oreilly at mbari.org (email)
> http://www.mbari.org (World-wide Web)
>   
> "The machine does not isolate us from the great mysteries
>   of nature, but plunges us more deeply into them."
>   
>     - ANTOINE DE SAINT-EXUPERY
>       "Wind, Sand, and Stars" (1939)
>
> ----- Original Message -----
> From: "Even Rouault" <even.rouault at spatialys.com>
> To: "Tom O'Reilly" <oreilly at mbari.org>, "gdal-dev" <gdal-dev at lists.osgeo.org>
> Sent: Monday, August 8, 2022 12:13:03 PM
> Subject: Re: [gdal-dev] gdal_translate drops XMP exif tags
>
> Tom,
>
> It would be interesting if you could provide an image how to reproduce that
>
> With the sample file from the autotest suite, I can't reproduce that:
>
> $ gdal_translate ../autotest/gdrivers/data/jpeg/byte_with_xmp.jpg out.tif
>
> $ gdalinfo out.tif -mdd all
>
> Driver: GTiff/GeoTIFF
> Files: out.tif
> Size is 1, 1
> Metadata (xml:XMP):
> <?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
> <x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 7.89'>
> <rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>
>
>    <rdf:Description rdf:about=''
>     xmlns:dc='http://purl.org/dc/elements/1.1/'>
>     <dc:description>
>      <rdf:Alt>
>       <rdf:li xml:lang='x-default'>Description</rdf:li>
>      </rdf:Alt>
>     </dc:description>
>     <dc:subject>
>      <rdf:Bag>
>       <rdf:li>XMP</rdf:li>
>       <rdf:li>Test</rdf:li>
>      </rdf:Bag>
>     </dc:subject>
>     <dc:title>
>      <rdf:Alt>
>       <rdf:li xml:lang='x-default'>Title</rdf:li>
>      </rdf:Alt>
>     </dc:title>
>    </rdf:Description>
>
>    <rdf:Description rdf:about=''
>     xmlns:tiff='http://ns.adobe.com/tiff/1.0/'>
>     <tiff:BitsPerSample>
>      <rdf:Seq>
>       <rdf:li>8</rdf:li>
>      </rdf:Seq>
>     </tiff:BitsPerSample>
>     <tiff:Compression>1</tiff:Compression>
>     <tiff:ImageLength>20</tiff:ImageLength>
>     <tiff:ImageWidth>20</tiff:ImageWidth>
> <tiff:PhotometricInterpretation>1</tiff:PhotometricInterpretation>
> <tiff:PlanarConfiguration>1</tiff:PlanarConfiguration>
>     <tiff:SamplesPerPixel>1</tiff:SamplesPerPixel>
>    </rdf:Description>
> </rdf:RDF>
> </x:xmpmeta>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> <?xpacket end='w'?>
> Metadata (DERIVED_SUBDATASETS):
> DERIVED_SUBDATASET_1_NAME=DERIVED_SUBDATASET:LOGAMPLITUDE:out.tif
>     DERIVED_SUBDATASET_1_DESC=log10 of amplitude of input bands from out.tif
> Image Structure Metadata:
>     INTERLEAVE=BAND
> Corner Coordinates:
> Upper Left  (    0.0,    0.0)
> Lower Left  (    0.0,    1.0)
> Upper Right (    1.0,    0.0)
> Lower Right (    1.0,    1.0)
> Center      (    0.5,    0.5)
> Band 1 Block=1x1 Type=Byte, ColorInterp=Gray
>
> Le 08/08/2022 à 20:32, Tom O'Reilly a écrit :
>> gdal_translate output .tif file does not contain XMP tags that were
>> present in the input .jpg file.
>> The output file contains many of the input EXIF tags, aggregated as
>> the GDALMetadata tag, but not the XMP tags.
>> Why does gdal_translate remove XMP tags - is there an option to
>> preserve them?
>>
>> Thanks
>> Tom
>> --------------------------------------------------
>> Thomas C. O'Reilly
>> Monterey Bay Aquarium Research Institute
>> 7700 Sandholdt Road
>> Moss Landing, California 95039-9644
>> 831-775-1766 (voice)
>> 831-775-1620 (FAX)
>> oreilly at mbari.org (email)
>> http://www.mbari.org (World-wide Web)
>>
>> "The machine does not isolate us from the great mysteries
>>   of nature, but plunges us more deeply into them."
>>
>>     - ANTOINE DE SAINT-EXUPERY
>>       "Wind, Sand, and Stars" (1939)
>>
>> _______________________________________________
>> gdal-dev mailing list
>> gdal-dev at lists.osgeo.org
>> https://lists.osgeo.org/mailman/listinfo/gdal-dev

-- 
http://www.spatialys.com
My software is free, but my time generally not



More information about the gdal-dev mailing list