I have an image that I'm trying to resize to a specific set of bounds.
I'm trying to use gdal to do this, but my problem is that gdal just adds a border of padded pixels to the image rather than actually resizing it.
Here is the image before (top) and after (bottom) resizing showing the boundary that I'm resizing to in red. The black pixels are nodata values added by GDAL; technically the image has been resized to the right proportions, but GDAL hasn't resampled any pixel values which is what I'm looking for.
These are the GDAL commands I've tried but neither output what I'm looking for:
gdalwarp -te 330585.0 8645385.0 604215.0 8918715.0 -tr 10 10 -overwrite "input.tif" "output.tif" gdalwarp -te 330585.0 8645385.0 604215.0 8918715.0 -ts 9111 9121 -overwrite "input.tif" "output.tif"
An alternative I have is to resize the image as an array using
scikit-image like this:
from skimage.transform import resize output = resize(input, (9111, 9121), preserve_range=True)
I'd rather avoid this solution because I'm trying to avoid reading the whole image into memory at once.