


I am so sorry.I need the image shape to be ellipse not rectangle,I.E. How can i get rid of the white background or make it invisible? Then I saved the returned image object,however it has white background in the corner

#mask = Image.new('RGB', (image.size - radius, image.size - radius))ĭraw.rectangle((0,0,width,height), aggdraw.Brush('white'))ĭraw.pieslice((0,0,radius*2, radius*2), 90, 180, None, brush)ĭraw.pieslice((width - radius*2, 0, width, radius*2), 0, 90, None, brush)ĭraw.pieslice((0, height - radius * 2, radius*2, height),180, 270, None, brush)ĭraw.pieslice((width - radius * 2, height - radius * 2, width, height), 270, 360, None, brush)ĭraw.rectangle((radius, radius, width - radius, height - radius), brush)ĭraw.rectangle((radius, 0, width - radius, radius), brush)ĭraw.rectangle((0, radius, radius, height-radius), brush)ĭraw.rectangle((radius, height-radius, width-radius, height), brush)ĭraw.rectangle((width-radius, radius, width, height-radius), brush) I got a square logo and I need to round_corner it, searched for a while and got the follow code "working": def round_corner_jpg(image, radius):
