[gdal-dev] gdal_translate on VRT gives black image

Guillaume Lostis g.lostis at kayrros.com
Thu Apr 2 03:09:35 PDT 2020


Hello,

I'm posting this here instead of Github as I don't know if it is a bug or
my misuse of the VRT format in conjunction with gdal_translate.

When I create a VRT (v.vrt) with a SimpleSource pointing to a simple 20x20
pixels TIFF file and I do:
gdal_translate v.vrt t.tif
I get a black image at t.tif.

I also get the same result if I do:
gdal_translate -srcwin 0 0 20 20 v.vrt t.tif

If I change xsize or ysize to something different from 20, e.g.:
gdal_translate -srcwin 0 0 21 20 v.vrt t.tif
then I get an image with the expected content.

Here's a simple VRT that can reproduce the issue:
<VRTDataset rasterXSize="20" rasterYSize="20">
  <VRTRasterBand dataType="Byte" band="1">
    <SimpleSource>
      <SourceFilename relativeToVRT="0">/vsicurl/
https://raw.githubusercontent.com/osgeo/gdal/master/autotest/gcore/data/byte.tif
</SourceFilename>
    </SimpleSource>
  </VRTRasterBand>
</VRTDataset>

Am I doing something wrong here, or is there an explanation as to why my
TIFF is black when the srcwin is the same size as the dataset, but OK when
the srcwin is larger or smaller than the dataset?

Thanks,
Guillaume Lostis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/gdal-dev/attachments/20200402/a2f72301/attachment.html>


More information about the gdal-dev mailing list