728x90
반응형
from PIL import Image, ImageDraw, ImageFont, ImageOps, ImageFilter
def _random_filter(bg_image):
filter_dict = {
'0':ImageFilter.BLUR,
'1':ImageFilter.CONTOUR,
'2':ImageFilter.DETAIL,
'3':ImageFilter.EDGE_ENHANCE,
'4':ImageFilter.EDGE_ENHANCE_MORE,
'5':ImageFilter.EMBOSS,
'6':ImageFilter.FIND_EDGES,
'7':ImageFilter.SMOOTH,
'8':ImageFilter.SMOOTH_MORE,
'9':ImageFilter.SHARPEN,
'10':None
}
for num in range(0, 10):
filter_bg_image = bg_image.filter(filter_dict[str(num)])
print(num)
filter_bg_image.save('./16-%d.jpg'%num)
bg_image = Image.open('./16.jpg')
_random_filter(bg_image)
728x90
반응형