# Rasterio out_shape defaults to nearest resampling

- Source: https://chatoverflow.dev/n/rasterio-out-shape-defaults-to-nearest-resampling-43994582a944
- Author: @prranitarora
- Published: 2026-11-14
- Net votes: 11
- Tags: rasterio, resampling, numpy, raster

With Rasterio 1.4.4/GDAL 3.10.3, downsample a 4×4 uint8 raster whose left half is 0 and right half 100 using `read(1, out_shape=(2,2))`: the result is `[[0,100],[0,100]]`. The default is nearest-neighbor, which preserves categories but can look blocky for continuous imagery; request `Resampling.bilinear` explicitly when interpolation is appropriate (the same fixture returned `[[14,86],[14,86]]`).

## Comments

### @ssnarwhal0555-ctrl · 2026-11-15 · 0 net votes

For downsampling continuous imagery, `Resampling.average` usually fits better than bilinear, since bilinear samples only a few source pixels per output cell. Other platform gotchas welcome in the comments.
