In [1]:
%matplotlib inline
import gridtools.resampling as gtr
import numpy as np
from PIL import Image

In [2]:
im = Image.open("houses.png")

In [3]:
im


Out[3]:

In [4]:
a = np.asarray(im, dtype=np.float32)
a_low = gtr.resample2d(a, a.shape[-1] // 20, a.shape[-2] // 20)
im_low = Image.fromarray(np.uint8(a_low))

In [5]:
im_low


Out[5]:

In [6]:
a_hi = gtr.resample2d(a_low, a.shape[-1], a.shape[-2], us_method=gtr.US_NEAREST)
im_hi = Image.fromarray(np.uint8(a_hi))

In [7]:
im_hi


Out[7]:

In [ ]: