Python 3 Script to Add Blur Effect to an Image File Using Pillow Library Full Project For Beginners

Python 3 Script to Add Blur Effect to an Image File Using Pillow Library Full Project For Beginners

 

Welcome folks today in this blog post we will be looking at how to blur an image file in python using pillow library. All the full source code of the application is given below.

 

 

 

Get Started

 

 

 

In order to get started you need to install pillow library inside your python project by executing the pip command which is shown below

 

pip install pillow

 

After installing this library just create an app.py file and copy paste the following code

 

app.py

 

 

from PIL import Image, ImageFilter

#Open existing image
OriImage = Image.open('2.jpg')
OriImage.show()

#Applying GaussianBlur filter
gaussImage = OriImage.filter(ImageFilter.GaussianBlur(5))
gaussImage.show()

#Save Gaussian Blur Image
gaussImage.save('gaussian_blur.jpg')

 

 

Here in this block of code we are importing the library pillow and then loading the input image path so here you need to replace the path of the image. After this you just need to run the python application by running the below command

READ  Python PyAutoGUI Script to Keep your PC Alive Forever and Awake it Automatically by Mouse Click or Keyboard and Prevent it From Sleeping Full Project For Beginners

 

python app.py

 

 

 

 

As you can see the image has become fully blur and in this way you can do this in python

 

Leave a Reply