Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Python – Sharpen and blur filtering using pgmagick

  • Last Updated : 05 Jul, 2021

Sharpening refers to increase contrast b/w light and dark regions and make image more defined and brings out image features. There are three main reasons to sharpen your image: to overcome blurring introduced by camera equipment, to draw attention to certain areas and to increase legibility. If a blurry text is present in image it becomes easy to read.
Now let’s learn how can we perform image sharpening in pgmagick library in python. We use sharpen() function to sharpen an image.
Code :


# importing library
from pgmagick import Image
img = Image('koala.jpg')
# sharpening image

Output : 


Blurring makes an image unclear and foggy. It doubtlessly decrease the clarity of an image. One is not able to see small edges if the image is blurred. Blur is a visual effect that makes the edges of text or images appear fuzzy or out of focus is referred to as a blur. Let’s see how can we blur image use pgmagick in Python.


# importing library
from pgmagick.api import Image
img = Image('koala.jpeg')
# blur image
img.blur(10, 5)

Output : 



My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!