The analysis and manipulation of a digital image is called image processing. Python is widely used for image processing applications to suit the need of the user. Let us see how image processing is done in Python.
We will use a library called Pillow.
Let us first install Pillow.
- In the Search Bar type cmd. The command window opens.
- Type ‘ pip install Pillow ‘ and Press Enter.
- Pillow library will get installed.
Let us check out some basic things in Pillow. We will not go into the depths of digital signal processing as it is beyond our scope. This blog just aims to give and introduction to image processing using Python.
- Opening an image
Here we open the image called ‘ball.jpg’ which is in the same folder as this program.
- To find Image Size
This prints the width and height of the image.
- Rotating an image
Here the image is rotated by 90 degree in the anticlockwise direction.
- Resizing an Image
This program resizes the image to specified dimension and saves it in another name.
Hope you enjoyed this tutorial. In the next tutorial we will use another library for image processing.