This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import rasterio | |
| def resize_image(infile, outfile): | |
| # Register GDAL format drivers and configuration options with a | |
| # context manager. | |
| with rasterio.Env(): | |
| with rasterio.open(infile) as dataset: | |
| data = dataset.read(1, out_shape=(st_img.shape[0], st_img.shape[1]), resampling=Resampling.bilinear) | |
| # scale image transform |