Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in how certain small sized ellipses are filled #1252

Closed
follower opened this issue Jun 4, 2015 · 4 comments
Closed

Regression in how certain small sized ellipses are filled #1252

follower opened this issue Jun 4, 2015 · 4 comments

Comments

@follower
Copy link

follower commented Jun 4, 2015

There has been a regression in how certain small sized ellipses are filled sometime between 2.3.0 and 2.6.1 and it is still present in 2.8.1.

The result is that the entire area is not filled--the bottom "edge" of the shape has a "bite" out of it.

Here is a magnified view of a comparison between versions--note the bottom of the green ellipse fill is incomplete in more recent versions:

pillow-ellipse-issues-2 3 0-vs-2 6 1-vs-2 8 1

This was first noticed when some code that drew a small white on black ellipse was moved from Pillow 2.3.0 to Pillow 2.7.0, I then replicated the results as far back as 2.6.1 and as far forward as 2.8.1.

It does not happen at all sizes, e.g. when size in the test script is at (I think) 51 pixels the issue is not apparent.

The change in behaviour is very noticeable at small sizes on low resolution displays.

(It should be noted that the original fill implementation has a bug in it--the "fill" is drawn outside the "outline" in certain places--which is no longer present in the current implementation but IMO this was less of an issue than the missing fill.)

Here are the details of where the test cases were run:

$ uname -a
Linux vagrant-ubuntu-trusty-64 3.13.0-46-generic #79-Ubuntu SMP Tue Mar 10 20:06:50 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
$ python --version
Python 2.7.6

The test script:

import Image, ImageDraw
size=50

for outline_colour in [ (0,0,255), None]:
    i=Image.new("RGB",(size,size),(255,0,0))
    id_=ImageDraw.Draw(i)
    id_.ellipse(((0,0),(size-1,size)), outline=outline_colour, fill=(0,255,0))
    i.save("ellipse-%s-%soutline.png" % (Image.PILLOW_VERSION,
                                       ("no-" if not outline_colour else "")))

Here are the individual files output by the test script:
ellipse-2 3 0-no-outline ellipse-2 3 0-outline ellipse-2 6 1-no-outline ellipse-2 6 1-outline ellipse-2 8 1-no-outline ellipse-2 8 1-outline

@follower
Copy link
Author

follower commented Jun 4, 2015

Looks like it might be related to: "Rewrite of the polygon_generic function"?

@hugovk
Copy link
Member

hugovk commented Jun 4, 2015

I've not checked in detail, but that sounds the likely cause. See also the related open issue #367 which still has things to be resolved, but it's not been touched in a while.

@radarhere
Copy link
Member

Testing before and after, I agree that it's related to 'Rewrite of the polygon_generic function'.

I've created a pull request that fixes the issue.

@radarhere
Copy link
Member

This issue can be closed now that the PR has been merged.

@hugovk hugovk closed this as completed Jun 18, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants