Proportionally resizing
We want to downscale the images of a veterinary blog website so all of them have the same compressed size.
It's important that you do this proportionally, meaning that these are not distorted.
First, you'll try it out for one image so you know what code to test later in the rest of the pictures.

The image preloaded as
dogs_banner
.
Remember that by looking at the shape of the image, you can know its width and height.
Diese Übung ist Teil des Kurses
Image Processing in Python
Anleitung zur Übung
- Import the module and function to resize.
- Set the proportional height and width so it is half the image's height size.
- Resize using the calculated proportional height and width.
Interaktive Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Import the module and function
from skimage.___ import ____
# Set proportional height so its half its size
height = int(____ / 2)
width = int(____ / 2)
# Resize using the calculated proportional height and width
image_resized = ____(dogs_banner, (____, ____),
anti_aliasing=True)
# Show the original and resized image
show_image(dogs_banner, 'Original')
show_image(image_resized, 'Resized image')