<div dir="ltr">Thanks Even, didn't know about gdalmove. I'll try !!<div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Il giorno gio 18 nov 2021 alle ore 15:47 Even Rouault <<a href="mailto:even.rouault@spatialys.com">even.rouault@spatialys.com</a>> ha scritto:<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>Black borders are completely expected: reprojection changes the
      geometry of the image.</p>
    <p>That said, if the area of interest is sufficiently small and the
      geometry change being approximatively an affine transformation,
      you can try <a href="https://gdal.org/programs/gdalmove.html" target="_blank">https://gdal.org/programs/gdalmove.html</a> instead of
      gdalwarp to only alter the georeferencing information and not
      touch pixel values at all.</p>
    <p>Even<br>
    </p>
    <div>Le 18/11/2021 à 15:34, Lorenzo Di
      Giacomo a écrit :<br>
    </div>
    <blockquote type="cite">
      
      <div dir="ltr">Hi Carl, thanks for your reply, i noticed that it
        happens even if i just reproject the image, without cutting.<br>
        Of course the dstalpha works, but it increases the size of the
        image and it changes its nature (adding another band) since this
        operation is an intermediate operation the resulting image can't
        be different from the original, just reporojected.<br>
        <br>
        <br>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">Il giorno gio 18 nov 2021 alle
          ore 14:11 Carl Godkin <<a href="mailto:cgodkin@gmail.com" target="_blank">cgodkin@gmail.com</a>> ha scritto:<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 dir="ltr"> Hi Lorenzo,
            <div><br>
            </div>
            <div>I have faced this and there are two things to consider.</div>
            <div><br>
            </div>
            <div>First, you can specify the georeferenced extents _and_
              the SRS  of the extents using something like this:</div>
            <div><br>
            </div>
            <div>    gdalwarp -t_srs EPSG:3857 \<br>
                      -te_srs EPSG:4326 -te -109 32 -102 36 \<br>
                      input.tif output.tif<br>
            </div>
            <div><br>
            </div>
            <div>Note that I'm warping to one coordinate system but
              trimming based on another one.  Is it possible that your
              black boundary is due to trimming in the wrong
              coordinate system?  For instance, if your input map is
              projected but the boundary of the map consists of
              parallels of latitude or meridians of longitude, then you
              could use something like the above.  (You can actually get
              even fancier by trimming with polygons too; see this
              example for inspiration: <a href="https://gis.stackexchange.com/questions/45053/gdalwarp-cutline-along-with-shapefile" target="_blank">https://gis.stackexchange.com/questions/45053/gdalwarp-cutline-along-with-shapefile</a>
              .)</div>
            <div><br>
            </div>
            <div>Second, recognize that the output will always be a
              rectangle in the output SRS.  If the black border is due
              to "no data" areas outside the input map's extent
              appearing in the output map, then you can use -dstalpha
              ("Create an output alpha band to identify nodata
              (unset/transparent) pixels.") to mark the output pixels
              that shouldn't be part of the map.  Basically your black
              pixels become transparent in this case.<br>
            </div>
            <div><br>
            </div>
            <div>I hope that helps,</div>
            <div>carl</div>
            <div><br>
            </div>
          </div>
          <br>
          <div class="gmail_quote">
            <div dir="ltr" class="gmail_attr">On Wed, Nov 17, 2021 at
              8:11 AM Lorenzo Di Giacomo <<a href="mailto:loridigia@gmail.com" target="_blank">loridigia@gmail.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 dir="ltr">Hi all, i have a question, how is it
                possible to avoid black borders after reprojection with
                "gdal_warp" ? <br>
                Basically i have an image that is little rotated, when i
                reprojected from 32632 to 4326 the resulting image has
                black borders more or less tight depending on the
                rotation.<br>
                I saw i can change the colors of those no_data (using <span style="font-variant-ligatures:no-common-ligatures;color:rgb(0,0,0);font-family:Menlo;font-size:11px">-dstnodata)
                  but how can i do if i dont want it at all? Adding
                  another band result in a size increase, that i don't
                  want either.<br>
                </span><br>
                Thanks !!</div>
              _______________________________________________<br>
              gdal-dev mailing list<br>
              <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
              <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
            </blockquote>
          </div>
          _______________________________________________<br>
          gdal-dev mailing list<br>
          <a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
          <a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
        </blockquote>
      </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>

_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="https://lists.osgeo.org/mailman/listinfo/gdal-dev" rel="noreferrer" target="_blank">https://lists.osgeo.org/mailman/listinfo/gdal-dev</a><br>
</blockquote></div>