ImageFilter

Apply different type of filters to the Image by un-commenting respective lines
from PIL import Image, ImageFilter

path = "E:\\testing\\images\\cat-filter.jpeg"# Source
path2 = "E:\\testing\\images\\cat-blur.jpeg"  # new image 
img = Image.open(path, mode="r")
#img.show()
#img = img.filter(ImageFilter.BLUR)
#img = img.filter(ImageFilter.BoxBlur(radius=10))
#img = img.filter(ImageFilter.GaussianBlur(radius=10))
#img = img.filter(ImageFilter.UnsharpMask(radius=10))
#img = img.filter(ImageFilter.Kernel(size=(3,3),kernel=[2,4])) # not workign 
#img = img.filter(ImageFilter.CONTOUR)
#img = img.filter(ImageFilter.DETAIL)
#img = img.filter(ImageFilter.EDGE_ENHANCE)
#img = img.filter(ImageFilter.EDGE_ENHANCE_MORE)
#img = img.filter(ImageFilter.EMBOSS)
#img = img.filter(ImageFilter.FIND_EDGES)
#img = img.filter(ImageFilter.SMOOTH)
#img = img.filter(ImageFilter.SMOOTH_MORE)
img = img.filter(ImageFilter.SHARPEN)
img.show()
img.save(path2)
Here are some sample images after using filters.
img = img.filter(ImageFilter.BLUR)
BLUR Filter

BoxBlur

img = img.filter(ImageFilter.BoxBlur(radius=10))
BoxBlur Filter

GussianBlur

img = img.filter(ImageFilter.GussianBlur(radius=10))
GussianBlur Filter

UnsharpMask

img = img.filter(ImageFilter.UnsharpMask(radius=10))
UnsharpMask Filter

CONTOUR

img = img.filter(ImageFilter.CONTOUR)
UnsharpMask Filter

DETAIL

img = img.filter(ImageFilter.DETAIL)

EDGE_ENHANCE

img = img.filter(ImageFilter.EDGE_ENHANCE)

EDGE_ENHANCE_MORE

img = img.filter(ImageFilter.EDGE_ENHANCE_MORE)
EDGE_ENHANCE_MORE Filter

EMBOSS

img = img.filter(ImageFilter.EMBOSS)
EMBOSS Filter

FIND_EDGES

img = img.filter(ImageFilter.FIND_EDGES)
FIND_EDGES Filter

SMOOTH

img = img.filter(ImageFilter.SMOOTH)
SMOOTH Filter

SMOOTH_MORE

img = img.filter(ImageFilter.SMOOTH_MORE)
SMOOTH_MORE Filter

SHARPEN

img = img.filter(ImageFilter.SHARPEN)
SHARPEN Filter
Python Imaging Library PIL ImageDraw to add Line, rectangle, circle to an Image. ImageDraw to add Text to an Image. Thumbnails using Pillow and Tkinter GUI Watermark on Image using text and Image
Subscribe to our YouTube Channel here


Subscribe

* indicates required
Subscribe to plus2net

    plus2net.com



    Post your comments , suggestion , error , requirements etc here





    Python Video Tutorials
    Python SQLite Video Tutorials
    Python MySQL Video Tutorials
    Python Tkinter Video Tutorials
    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2024 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer