gizeh
gizeh copied to clipboard
gizeh.ImagePattern broke using Numpy ver 10
File "animation/target_animation.py", line 161, in draw
fill = gizeh.ImagePattern(self.bg.data, self.bg.pos, filter='best')
File "build/bdist.linux-x86_64/egg/gizeh/gizeh.py", line 295, in __init__
File "build/bdist.linux-x86_64/egg/gizeh/gizeh.py", line 50, in from_image
TypeError: Cannot cast ufunc add output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'
I tried reporting this issue to numpy but they said the gizeh code needs to be modified:
You need to make the cast explicit using the casting
argument in the np.add
ufunc. That is casting='unsafe'
.
Would you fix this issue please? I would like to use gizeh and the latest version of numpy.
For ref: https://github.com/numpy/numpy/issues/7225
It can be fixed by modifying line 50 in "gizeh.py" from:
arr += image.flatten()
to:
#arr += image.flatten()
np.add(arr, image.flatten(), out=arr, casting="unsafe")
Pull request #32 should fix this issue.