From 6172ef740dd74341e02226ffcdb4948120a6c6de Mon Sep 17 00:00:00 2001 From: bitblomster Date: Tue, 30 Jan 2018 16:05:35 +0100 Subject: [PATCH] Explicit cast using np.add. Fixes dependency on deprecated numpy behaviour, as described in gizeh issue #25 and numpy issue #7225 --- gizeh/gizeh.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gizeh/gizeh.py b/gizeh/gizeh.py index 48ca11e..18d4f2f 100644 --- a/gizeh/gizeh.py +++ b/gizeh/gizeh.py @@ -49,7 +49,7 @@ def from_image(image): image = np.dstack([image, 255 * np.ones((h, w))]) sf = Surface(w, h) arr = np.frombuffer(sf._cairo_surface.get_data(), np.uint8) - arr += image.flatten() + np.add(arr, image.flatten(), out=arr, casting="unsafe") sf._cairo_surface.mark_dirty() return sf