0

I'm using gdalwarp -dstalpha src.tif dst.tif to add alpha channel to an 8-bit unsigned image with 3 bands. The initial size of the image is 300 mb, but adding an alpha band increases it to 1980 mb, which is far more than expected 1/4 increase.

What is the matter?

4
  • The original image is probably compressed and you write out an uncompressed image. Check with gdalinfo and use suitable -co compress= option.
    – user30184
    Dec 16, 2017 at 14:24
  • 1
    Could you please provide your full gdalwarp call?
    – onakua
    Dec 16, 2017 at 16:09
  • Yeah that is my concern. If his gdalwarp call involved clipping (instead of simply adding an alpha band) it will result in file inflation, which as you mention is duplicate.
    – onakua
    Dec 16, 2017 at 22:02
  • @onakua I don't think it matters, solution is the same: gdalwarp -of VRT -dstalpha src.tif dst.vrt && gdal_translate -co compress=whatever dst.vrt dst.tif
    – user2856
    Dec 16, 2017 at 22:11

0

Browse other questions tagged or ask your own question.