Drawing methods edges aren't smooth

Open
#5,960 4 comments 2 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
python

Research direction

Start with Pillow's drawing methods, especially the .ellipse() entry point described in the issue, and compare its edges with the existing Image.ANTIALIAS resize approach. Determine the intended antialiasing behavior for curves and lines, then validate the result against the reported pixelation example and define coverage for other drawing methods.

Written by the indexing model from the issue text.

Description

Enhancement

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

Dominant language
Python
Stars
14k
Forks
2.6k
Avg merge
1d 1h
Merged PRs (30d)
205

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from python-pillow/Pillow

All issues in python-pillow/Pillow

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.