mirror of
https://github.com/wassname/scikit-image.git
synced 2026-07-01 18:22:39 +08:00
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:
@@ -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)
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user