Get startedGet started for free

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.

This exercise is part of the course

Image Processing in Python

View Course

Exercise instructions

  • 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.

Hands-on interactive exercise

Have a go at this exercise by completing this sample code.

# 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')
Edit and Run Code