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
ImageDraw.polygon
regression if polygon is a line
#6275
Comments
Testing, the change is because of #5835. Because that PR was undoing part of #4333, I checked, and yes - the Pillow >= 9 behaviour is also how Pillow behaved <= 7. So I don't think this can be considered a clear-cut regression. Seeing that aside for a moment, could you give an explanation why you think the current behaviour is not correct? Yes, you're drawing a polygon of zero height, but you're also outlining it, so it doesn't seem unreasonable to me that something is drawn. |
Thank you @radarhere for the quick reply. I was reporting it not necessarily saying that the new behavior is wrong, just I was not sure which one was the "correct" one. Also, I was not sure if you were aware of this change :) I spotted this because this example was an edge case for a test in histolab, where we were mostly using it to document what would happen if the polygon was a line. So I'm fine changing the expectation on our end, I just wanted to make sure this was the intended result |
#4333 wasn't intended to change which pixels were filled in, so yes, I'd say that the <=7 behaviour of your code is correct. Meaning that the behaviour >= 9 is also correct. |
So, #4333 unintentionally changed this behaviour. #5835 switched your code back to the original approach, but left the new approach in place when translucency is involved. I've created PR #6278. It doesn't change the output of your code, but it does fix 1px high polygons when translucency is involved - meaning that even if #5835 hadn't switched back to Pillow's behaviour <= 7, it would now. |
Thank you @radarhere for the investigation and for confirming that this is the correct behavior! |
What did you do?
The behavior of
ImageDraw.polygon
changed between versions 8.0.4 and 9.0.0 if the polygon is a line.Could it be related to #5694?
What did you expect to happen?
This was the result with Pillow 8.0.4
What actually happened?
This is the result with Pillow >= 9.0.0
What are your OS, Python and Pillow versions?
The text was updated successfully, but these errors were encountered: