<div dir="ltr"><div>Tnx Even</div><div><br></div><div>I suspected that -strict was not "complete". In any case My first code version was adding tags over an already generated COG, but the result was an unreadable/broken file in QGIS. I suppose because pyexiv2 is not flexible enough and stuck with a rigid version of tiff structure.</div><div>I'll try a workaround using some lib or app able to maintain a readable image, tnx for the hint.</div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><br></div><div>Luigi Pirelli<br><br>**************************************************************************************************<br>* LinkedIn: <a href="https://www.linkedin.com/in/luigipirelli" target="_blank">https://www.linkedin.com/in/luigipirelli</a><br>* Stackexchange: <a href="http://gis.stackexchange.com/users/19667/luigi-pirelli" target="_blank">http://gis.stackexchange.com/users/19667/luigi-pirelli</a><br>* GitHub: <a href="https://github.com/luipir" target="_blank">https://github.com/luipir</a><br>* Book: <a href="https://www.packtpub.com/eu/application-development/mastering-geospatial-development-qgis-3x-third-edition" target="_blank">Mastering QGIS3 - 3rd Edition</a></div><div>**************************************************************************************************</div></div></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, 14 Nov 2024 at 13:02, Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><u></u>
<div>
<p>Luigi,</p>
<p>The GDAL GeoTIFF or COG drivers have currently no provision for
writing EXIF (the fact that you see Exif.Image.Software is due to,
I assume, exiftool synthetizing that information from the regular
Software TIFF tag, which is propagated), so I don't have any
solution to offer. Could potentially be implemented, but not a
5-minute job.</p>
<p>"Breaking" the COG structure shouldn't be the end of the world.
The breakage should be minimal. That will just cause one extra
HTTP GET to clients. 95% of the value of COG is just being a tiled
GeoTIFF with overviews. Putting all metadata (including the main
TIFF directory) at beginning of the file is just the cherry on the
cake.</p>
<p>(a quick skim at <a href="https://github.com/airbusgeo/cogger" target="_blank">https://github.com/airbusgeo/cogger</a> which is
useful to COGify a tiled GeoTIFF doesn't show any provision for
EXIF, so I don't think you can use it for your use case)</p>
<p>The XMP TIFF tag is propagated:</p>
<p>$ gdal_translate autotest/gdrivers/data/gtiff/byte_with_xmp.tif
out.tif -of cog</p>
<p>$ gdalinfo out.tif -mdd all | grep XMP<br>
Metadata (xml:XMP):<br>
<rdf:li>XMP</rdf:li><br>
<br>
</p>
<p>Even<br>
</p>
<div>Le 14/11/2024 à 12:39, Luigi Pirelli
via gdal-dev a écrit :<br>
</div>
<blockquote type="cite">
<div dir="ltr">
<div>Hi,</div>
<div><br>
</div>
<div>I'm struggling to generate a COG maintaining the original
(or at least a selected subset of) Exif and XMP tags (I ses
that Iptc tags are not propagated at all, but I'm not
interested in them).<br>
I used gda_translate via CLI or python and the best option
seems -strict that, theoretically should maintain all original
tags.<br>
<br>
But some standard tags are propagated and others not!</div>
<div>e.g.</div>
<div>Exif.Image.Software yes</div>
<div>Exif.Photo.CameraOwnerName no<br>
</div>
<div>Exif.Image.Artist yes<br>
</div>
<div>Exif.Image.Copyright yes<br>
</div>
<div>Exif.Image.DateTimeOriginal no<br>
</div>
<div>Exif.Photo.DateTimeOriginal no<br>
</div>
<div>Exif.Image.Model no<br>
</div>
<div>Exif.Image.CameraSerialNumber no</div>
<div>etc</div>
<div><br>
</div>
<div>It is a bug? a feature? if a bug in any case is there a way
to override? The reason to find a solution is that adding tags
over a COG with "standard" tools like exiftool, exiv2 etc
destroy COG structure. So I need to add or modify tags before
converting to COG.</div>
<div><br>
</div>
<div>any suggestion?</div>
<div><br>
</div>
<div>
<div dir="ltr" class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>
<div dir="ltr">
<div>Luigi Pirelli</div>
<div>mails: <a href="mailto:luipir@gmail.com" target="_blank">luipir@gmail.com</a></div>
<div> <a href="mailto:luigi.pirelli@geobeyond.it" target="_blank">luigi.pirelli@geobeyond.it</a><br>
<br>
**************************************************************************************************<br>
* LinkedIn: <a href="https://www.linkedin.com/in/luigipirelli" target="_blank">https://www.linkedin.com/in/luigipirelli</a><br>
* Stackexchange: <a href="http://gis.stackexchange.com/users/19667/luigi-pirelli" target="_blank">http://gis.stackexchange.com/users/19667/luigi-pirelli</a><br>
* GitHub: <a href="https://github.com/luipir" target="_blank">https://github.com/luipir</a><br>
* Book: <a href="https://www.packtpub.com/eu/application-development/mastering-geospatial-development-qgis-3x-third-edition" target="_blank">Mastering
QGIS3 - 3rd Edition</a></div>
<div>**************************************************************************************************</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<br>
<fieldset></fieldset>
<pre>_______________________________________________
gdal-dev mailing list
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a>
</pre>
</blockquote>
<pre cols="72">--
<a href="http://www.spatialys.com" target="_blank">http://www.spatialys.com</a>
My software is free, but my time generally not.
Butcher of all kinds of standards, open or closed formats. At the end, this is just about bytes.</pre>
</div>
</blockquote></div>