Zulko / gizeh

Simple Vector Graphics for Python
Other
702 stars 70 forks source link

I find problem in Surface.from_image() function.... #51

Open LQY404 opened 3 years ago

LQY404 commented 3 years ago

the probelm is: when i use a image, to initial the Surface, error was arise: _UFuncTypeError: Cannot cast ufunc 'add' output from dtype('float64') to dtype('uint8') with casting rule 'same_kind'_

after look for the source code, I find the problem of source code: np.dstack([image, 255 * np.ones((h, w))])

the input image' shape is [w, h, 3], type is np.uint8 I change the code to: np.dstack([image, 255 * np.ones((h, w), dtype=np.uint8)])

the problem is disappear.