How do I generate circular thumbnails with PIL?
The easiest way to do it is by using masks. Create a black and white mask with any shape you want. And use putalpha to put that shape as an alpha layer: 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’) Here is the mask … Read more