mirror of
https://github.com/wassname/scikit-image.git
synced 2026-08-12 12:30:16 +08:00
Force novice.Picture.from_size to return a uint8 image
Force Picure.from_size to return a uint8 image Remove img_as_ubyte
This commit is contained in:
@@ -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:
|
||||
|
||||
@@ -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