[gdal-dev] gdal_translate drops XMP exif tags

Tom O'Reilly oreilly at mbari.org
Mon Aug 8 13:13:39 PDT 2022


Hi Evan,

I was mistaken in which gdal program drops the XMP tags.
gdal_translate actually transfers the XMP tags properly from the input jpg file to tif output.  But a subsequent gdalwarp on that tif does not pass the XMP tags to its output.

So the sequence is, for example:

step 1: Convert jpg to geotiff, using specified gcps
gdal_translate -gcp 7952 0 -121.7912 36.8015 -gcp 7952 5304 -121.7910 36.8012 -gcp 0 5304 -121.7915 36.8010 -gcp 0 0 -121.7917 36.8013  -of GTiff  -co COMPRESS=DEFLATE -a_srs EPSG:4326 DSC01221.JPG test.tif

step 2: Warp the geotiff 
gdalwarp -t_srs EPSG:4326 -of GTiff -dstalpha test.tif testwarp.tif


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.

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