def lomoize (image,darkness,saturation):
(width,height) = image.size
max = width
if height > width:
max = height
mask = Image.open("./lomolive/lomomask.jpg").resize((max,max))
left = round((max - width) / 2)
upper = round((max - height) / 2)
mask = mask.crop((left,upper,left+width,upper + height))
# mask = Image.open('mask_l.png')
darker = ImageEnhance.Brightness(image).enhance(darkness)
saturated = ImageEnhance.Color(image).enhance(saturation)
lomoized = Image.composite(saturated,darker,mask)
return lomoized
评论列表
文章目录