Comments (12)
What version of python and what operating system? Thanks.
from aggdraw.
python 2.7.14 on macOS Sierra
from aggdraw.
With the old version of aggdraw is this what the result looked like for you (this is Python 3.6, OSX High Sierra):
from aggdraw.
Yes.
I'll see if the issue persists with Python 3. If not, all the more reason to migrate
from aggdraw.
The bug does not appear with Python 3.6.
from aggdraw.
What if you don't use any alpha (RGB instead of RGBA) when running it in python 2? I've been told by more experienced users (I just maintain the code) that aggdraw has always had less than ideal handling of alpha.
from aggdraw.
Without alpha (I presume you mean making the array MxNx3 and mode = "RGB") the bug appears with both Python 2 and 3.
from aggdraw.
@bhbr I'm just now reviewing this code and I'm a little confused by what is happening. The way you are creating a Draw object, flushing it, then using the original pixel_array to make a new image, is this advertised/accepted behavior for aggdraw
? Is the expectation that pixel_array
will get written to in-place through the Image object? Or am I looking at this too early in the morning and misunderstanding something?
from aggdraw.
Hi,
I just hit on this bug while trying https://github.com/3b1b/manim. I bisected library and it looks like it's because of commit 1832993, I did also try your reproducer with and without commit and it seems to be hitting same thing.
I hope it helped.
from aggdraw.
So what I think is happening is:
in static agg::rgba8 getcolor(PyObject* color, int opacity) https://github.com/pytroll/aggdraw/blob/master/aggdraw.cxx#L896
in if
statement PyBytes_Check(color)
was changed to PyUnicode_Check(color)
which is false in situations where PyBytes_Check was true.
next even if you skip that PyObject* ascii_color = PyUnicode_AsASCIIString(color); will always give you NULL.
I don't think PyUnicode_Check and PyUnicode_AsASCIIString are used corectly in that file
from aggdraw.
Awesome @burlito thanks for the help. I agree it looks like I screwed up the python 2 support. There should be a second else if statement to check for the bytes.
For your second point, what do you mean PyUnicode_AsASCIIString will always return NULL
? In both python 2 and 3 that should convert a unicode object to an ascii string if it can be converted (https://docs.python.org/3/c-api/unicode.html#c.PyUnicode_AsASCIIString). As mentioned the code should have another if statement for bytes and then run PyBytes_AsString(color)
. You are right that the PyUnicode_AsASCIIString
will always return NULL for a bytes object (if it doesn't crash), but that function shouldn't be called in that case.
I'll see if I can find time to test this later.
from aggdraw.
I have this fixed locally, but it seems a test is failing on python 2 now and I can't get it to pass even after removing my changes. This should be fun.
from aggdraw.
Related Issues (20)
- antigrain.com is squatted HOT 6
- multline text not supported HOT 1
- Line anti-aliasing issues due to missing sRGB mishandling HOT 5
- Resolve differences after agg 2.2 and agg 2.4 migration HOT 3
- aggdraw.Draw, aggdraw.Pen, aggdraw.Brush, etc... are not extendable (apparently) HOT 1
- Cannot install on Windows HOT 2
- MNT: Stop using ci-helpers in appveyor.yml HOT 1
- documentation has left the chat. HOT 1
- Latest Documentation? HOT 7
- pip install results in error Windows 10 21H1 HOT 4
- aggdraw does not some to be able to find fonts when installed in a venv HOT 3
- No arc symbols? HOT 1
- is there a way to draw squircle (rectangle with rounded edges) ? HOT 4
- Add support to release linux aarch64 wheels HOT 3
- PyPy3.8 support HOT 6
- Windows binaries are missing for aggdraw 1.3.13 on pypi.org HOT 4
- The value in the coordinates list cannot exceed 32767. HOT 1
- Diferences between pip version and source-compiled version HOT 4
- Misleading information in the document HOT 6
- freetype not linked correctly in latest macOS Python 3.11 wheels (1.3.17 and 1.3.18) HOT 19
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aggdraw.