0

I have a tif file of 7378 X 6923(widthXheight) resolution. I resized it to 1200 X 1200 pixels using Image class in python.

 img = Image.open('path to tif file')
 img = img.resize((1200,1200))

But after resizing, the pixel values show unusual values. Before resizing, a certain pixel's value was 125.28. Now, after resizing, that pixel's value has turned to 1123715645. I am reading the pixel value with:

with rasterio.open('path to tif file') as dataset:
    band = dataset.read(1)
    print(type(band))
    value_of_interest = band[row_of_interest, column_of_interest]
    print(value_of_interest)

Why does this happen?

How can I preserve the height values in same pixel position?

0 Answers0