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
# importing library from pgmagick import Image img = Image( 'koala.jpg' ) # sharpening image 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
# importing library from pgmagick.api import Image img = Image( 'koala.jpeg' ) # blur image img.blur( 10 , 5 ) img.write( 'blur_koala.jpeg' ) |
Output :