python-pillow / python-pillow/Pillow

Drawing methods edges aren't smooth

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

Nobody has claimed this yet.

Dominant language
Python
Stars
13.8k
Forks
2.5k
Avg merge
2d 8h
Merged PRs (30d)
89

Description

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

Contributor guide

Open the contributing guide

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.

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.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.