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 :
Python3
from pgmagick import Image
img = Image( 'koala.jpg' )
img.sharpen( 2 )
img.write( 'sharp_koala.jpg' )
|
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.
Python3
from pgmagick.api import Image
img = Image( 'koala.jpeg' )
img.blur( 10 , 5 )
img.write( 'blur_koala.jpeg' )
|
Output :
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...