As we have seen, down-sampling is not very good for shrinking images as it creates an aliasing effect. For instance, if we try to resize (down-sample) the original image by reducing the width and height a factor of 5, we shall get such patchy and bad output.
Anti-aliasing
The problem here is that a single pixel in the output image corresponds to 25 pixels in the input image, but we are sampling the value of a single pixel instead. We should be averaging over a small area in the input image. This can be done using ANTIALIAS (a high-quality down-sampling filter); this is how you can do it:
im = im.resize((im.width//5, im.height//5), Image.ANTIALIAS)pylab.figure(figsize=(15,10)), pylab.imshow(im), pylab.show() ...