Pillow icon indicating copy to clipboard operation
Pillow copied to clipboard

Drawing methods edges aren't smooth

Open DeusAres opened this issue 3 years ago • 4 comments

Originally posted by @radarhere in https://github.com/python-pillow/Pillow/issues/4895#issuecomment-1013763728

@DeusAres could you create a new issue with more detail?

In general the drawing methods don't have an antialiasing method, meaning that curves and lines that aren't straight are affected by pixelation:

I'm asking if there will be an implemention, like kerneling the drawn figures with methods such gaussian blur and to apply antialiasing so super-sampling can be avoided

The way that I use to superSample is to resize N times (2<=N<=8) the width and height and resize it back with Image.ANTIALIAS resampling

Taking this image in account:

image

It's a simple circle using .ellipse() method on a 1000x1000 canvas but the edges aren't smooth because of the pixelation. The bigger the figure the less it's noticeable of course but that isn't the way to solve the issue

DeusAres avatar Jan 15 '22 22:01 DeusAres

have a try image.save(name, quality=100, subsampling=0)

chiboreache avatar Jan 27 '22 21:01 chiboreache

Actually, I find this useful. If this is changed, can there be a toggle for this?

balt-dev avatar Mar 08 '22 02:03 balt-dev

Can I bump this again? I edited the poor English I used to write this issue, maybe it's clearer now

have a try image.save(name, quality=100, subsampling=0)

Doesn't work in this case. It's not an error or problem in the saving process, but more of a missing feature in the ImageDraw methods

DeusAres avatar Mar 08 '22 10:03 DeusAres

@DeusAres there isn't an open PR for this, so no, there isn't any work currently in progress. But that doesn't mean that such a change would be rejected. Feel free to dive into the code and create a pull request.

@balt-is-you-and-shift could you elaborate on why you find this useful?

radarhere avatar Mar 09 '22 11:03 radarhere