Issue
How do I generate circular thumbnails with PIL? shows a way how to make circular thumbnails.
Following the sample and I am using a picture here, and here's what's generated.
The generated picture quality doesn't look very good, I want to improve it, so change the last line a bit:
from PIL import Image, ImageOps
mask = Image.open('mask.png').convert('L')
im = Image.open('image.png')
output = ImageOps.fit(im, mask.size, centering=(0.5, 0.5))
output.putalpha(mask)
output.save('output.png', dpi=(800,800))
But seems the picture quality is not improved.
What's the way to improve the picture quality after circled?
Solution
Try using a different downsampling filter, by adding, for example, method=Image.LANCZOS
to the .fit
call.
Answered By - Ture Pålsson
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.