diff --git a/skimage/novice/_novice.py b/skimage/novice/_novice.py index cac72ee2..28df15d4 100644 --- a/skimage/novice/_novice.py +++ b/skimage/novice/_novice.py @@ -282,6 +282,7 @@ class Picture(object): color = color_dict[color] rgb_size = tuple(size) + (len(color),) array = np.ones(rgb_size, dtype=np.uint8) * color + array = array.astype(np.uint8) # Force RGBA internally (use max alpha) if array.shape[-1] == 3: diff --git a/skimage/novice/tests/test_novice.py b/skimage/novice/tests/test_novice.py index e2aafef0..36f4a537 100644 --- a/skimage/novice/tests/test_novice.py +++ b/skimage/novice/tests/test_novice.py @@ -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))