Operation on Images Part 1

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.

 

screenshot-82-e1522719712189.png

  • To find Image Size

This prints the width and height of the image.

screenshot-83.png

  • Rotating an image 

Here the image is rotated by 90 degree in the anticlockwise direction.

screenshot-84-e1522719040132.png

screenshot-841.png

  • Resizing an Image

This program resizes the image to specified dimension and saves it in another name.

screenshot-88.png

screenshot-86.png

Hope you enjoyed this tutorial. In the next tutorial we will use another library for image processing.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Powered by WordPress.com.

Up ↑

%d bloggers like this: