Hi Everyone
I recently tried to experiment with the Python Pillow Library.
I tried to resize and round the corners of the following image.
I got an unexpected result due to the sharp pixels in the circumference.
But when I tried the same using an image editor, there was a smooth circumference.
I tried to use FileImage.filter(ImageFilter.SMOOTH_MORE)
but the quality deteriorated.
My code to edit the Image
RoundSize= 60
FileImage = Image.open("Image.png")
Size = 200
FileImage = FileImage.resize((Size,int((float(FileImage.size[1])*float((Size/float(FileImage.size[0])))))), Image.ANTIALIAS)
Round = Image.new('L', (RoundSize* 2, RoundSize* 2), 0)
Draw = ImageDraw.Draw(Round)
Draw.ellipse((0, 0, RoundSize* 2, RoundSize* 2), fill=255)
ModifiedImage = Image.new('L', FileImage.size, 255)
Width, Height = FileImage.size
ModifiedImage.paste(Round.crop((0, 0, RoundSize, RoundSize)), (0, 0))
ModifiedImage.paste(Round.crop((0, RoundSize, RoundSize, RoundSize* 2)), (0, Height - RoundSize))
ModifiedImage.paste(Round.crop((RoundSize, 0, RoundSize* 2, RoundSize)), (Width - RoundSize, 0))
ModifiedImage.paste(Round.crop((RoundSize, RoundSize, RoundSize* 2, RoundSize* 2)), (Width - RoundSize, Height - RoundSize))
FileImage.putalpha(ModifiedImage)
FileImage.save("Python Edited.png")