I am trying to clip my Raster file according to a shapefile geometry. I am using the following code
gdalwarp -cutline INPUT.shp INPUT.tif OUTPUT.tif
But it is resulting a black color outside the shapefile geometry extent. I am giving the example here. In the first Image that I want to clip. The second image is the resultant raster but I want the 3rd Raster where the outside of the geometry will be null.

1st Image: INPUT Raster

2nd Image: OUTPUT Raster

3rd Image: I want to get output like this
-dstalphais OK to use with imagery (it basically adds an alpha Band in GeoTIFF and mask the area). However, data values remains in the source Band (in this case I guess, that it is value 0). If you want to work with this as raster values (not imagery),-dstalphais WRONG approach.@Curlew answer is much preferable option. Also, I found-crop_to_cutlineoption very dangerous, if you need to keep exact overlay (pixel-size and spacing) with the input raster. I prefer to set-teoptions (bounding box) to keep coordinates under full control. – jurajb Oct 02 '18 at 07:37Getting invalid syntax
– sameer_nubia Oct 20 '20 at 11:45