[gdal-dev] gdal_translate drops XMP exif tags

Rahkonen Jukka jukka.rahkonen at maanmittauslaitos.fi
Mon Aug 8 13:17:26 PDT 2022


Hi,

If gdal_translate keeps the tags you should be able to create a small test file by reducing the size with -outsize.

-Jukka Rahkonen-



-----Alkuperäinen viesti-----
Lähettäjä: gdal-dev <gdal-dev-bounces at lists.osgeo.org> Puolesta Tom O'Reilly
Lähetetty: maanantai 8. elokuuta 2022 23.14
Vastaanottaja: Even Rouault <even.rouault at spatialys.com>
Kopio: gdal-dev <gdal-dev at lists.osgeo.org>
Aihe: Re: [gdal-dev] gdal_translate drops XMP exif tags

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)
https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mbari.org%2F&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C7c347d29dbc44bf5dcb208da797a9f78%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637955864831990006%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KKLklE5oY8xr8uuILSsV32YGgD9NPoghdD%2BQ9uxdIjY%3D&reserved=0 (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='https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.w3.org%2F1999%2F02%2F22-rdf-syntax-ns%23&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C7c347d29dbc44bf5dcb208da797a9f78%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637955864831990006%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=D8SUyL%2BKKVW8Ujx7GKclIcLZ4ru%2BM%2BnpbKkQ8O%2BtL28%3D&reserved=0'>

  <rdf:Description rdf:about=''
   xmlns:dc='https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpurl.org%2Fdc%2Felements%2F1.1%2F&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C7c347d29dbc44bf5dcb208da797a9f78%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637955864831990006%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=j2rNZAD9uKn588r5dnI5y3jNk8VxYVgpNwbmiE6uLWs%3D&reserved=0'>
   <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='https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fns.adobe.com%2Ftiff%2F1.0%2F&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C7c347d29dbc44bf5dcb208da797a9f78%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637955864831990006%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=DfHhnsqwL0IP%2BamOJ4fpcniNEmP%2BDyR6hpJq0Cv5fq8%3D&reserved=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)
> https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.mbari.org%2F&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C7c347d29dbc44bf5dcb208da797a9f78%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637955864831990006%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KKLklE5oY8xr8uuILSsV32YGgD9NPoghdD%2BQ9uxdIjY%3D&reserved=0 (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://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C7c347d29dbc44bf5dcb208da797a9f78%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637955864831990006%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Mc0CKOxHPW8lR5rJM9N9i%2BMY9ZYU0hWrptG2QOS4ih0%3D&reserved=0

-- 
https://eur06.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.spatialys.com%2F&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C7c347d29dbc44bf5dcb208da797a9f78%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637955864832146270%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=XzyLX7t5lr3uSfUXSekYHwMpr%2FvlEqIJ7KATBbHS0iM%3D&reserved=0
My software is free, but my time generally not

_______________________________________________
gdal-dev mailing list
gdal-dev at lists.osgeo.org
https://eur06.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.osgeo.org%2Fmailman%2Flistinfo%2Fgdal-dev&data=05%7C01%7Cjukka.rahkonen%40maanmittauslaitos.fi%7C7c347d29dbc44bf5dcb208da797a9f78%7Cc4f8a63255804a1c92371d5a571b71fa%7C0%7C0%7C637955864832146270%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=6BD9A5sEOdtKt2DVCQk444G8tsJ9aIugFyFHHeDtfcQ%3D&reserved=0


More information about the gdal-dev mailing list