November 2018
Intermediate to advanced
492 pages
12h 19m
English
In order to decrease the size of an image, we need to down-sample the image. For each pixel in the new smaller image, there will be multiple pixels in the original larger image. We can compute the value of a pixel in the new image by doing the following:
Let's use the tajmahal.jpg image and resize it to an output image of a size 25 times smaller than the input image using the resize() function, again from the PIL library:
im = Image.open("../images/tajmahal.jpg") ...Read now
Unlock full access