Merge pull request #1359 from blink1073/fix-novice-from-size

Force `novice.Picture.from_size` to return a uint8 image
This commit is contained in:
Juan Nunez-Iglesias
2015-01-31 14:35:37 +11:00
2 changed files with 3 additions and 0 deletions
+1
View File
@@ -281,6 +281,7 @@ class Picture(object):
if isinstance(color, six.string_types):
color = color_dict[color]
rgb_size = tuple(size) + (len(color),)
color = np.array(color, dtype=np.uint8)
array = np.ones(rgb_size, dtype=np.uint8) * color
# Force RGBA internally (use max alpha)
+2
View File
@@ -86,6 +86,8 @@ def test_pixel_rgb():
pixel.rgb = np.arange(4)
assert_equal(pixel.rgb, np.arange(3))
assert pic.array.dtype == np.uint8
def test_pixel_rgba():
pic = novice.Picture.from_size((3, 3), color=(10, 10, 10))