<div dir="ltr">Thank you Even. You are totally right as always. The reason is the broken overview.<br><br>$ gdal_translate -outsize 1% 1% -oo OVERVIEW_LEVEL=0 input_raster_to_resize_with_max_val_92.tiff output-0ovr.tif<div><br>$ gdal_translate -outsize 1% 1% input_raster_to_resize_with_max_val_92.tiff output.tif<br><br></div><div>$ gdalinfo -stats -json output.tif | jq '.bands[0].metadata[""].STATISTICS_MAXIMUM'<br>"3149.9255371094"<br><br></div><div>$ gdalinfo -stats -json output-0ovr.tif | jq '.bands[0].metadata[""].STATISTICS_MAXIMUM'<br>"70.651634216309"<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Thu, May 20, 2021 at 9:51 PM Even Rouault <<a href="mailto:even.rouault@spatialys.com" target="_blank">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">
  
    
  
  <div>
    <p>Denis,</p>
    The maximum of nearest downsampling should be <= maximum of full
    resolution.<br>
    <p>Potential explanations:</p>
    <p>- your source file has overviews that contain completely
      different values than the full resolution image.</p>
    <p>- or perhaps your input_raster_to_resize_with_max_val_92.tiff
      file has a .aux.xml with outdated stats (gdalinfo -stats doesn't
      regenerate stats if already found)</p>
    <p>Even<br>
    </p>
    <div>Le 20/05/2021 à 21:42, Denis Rykov a
      écrit :<br>
    </div>
    <blockquote type="cite">
      <div dir="ltr">
        <pre><code><span>$ gdalinfo -stats -json input_raster_to_resize_with_max_val_92.tiff | jq '.bands[0].metadata[""].STATISTICS_MAXIMUM'
"92"
$ gdal_translate -outsize 1% 1% input_raster_to_resize_with_max_val_92.tiff output.tif                             
Input file size is 6845, 10302
0...10...20...30...40...50...60...70...80...90...100 - done.
$ gdalinfo -stats -json output.tif | jq '.bands[0].metadata[""].STATISTICS_MAXIMUM'                                 
"3149.9255371094"
</span></code><span>
</span><span>I expected to get the same or at least close value as in the original raster. What might be the reason for that behavior?<code><span>
</span></code></span></pre>
        <pre><code><div><div><div>
</div></div></div></code></pre>
      </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.</pre>
  </div>

</blockquote></div>