mirror of
https://github.com/wassname/scikit-image.git
synced 2026-10-02 12:41:06 +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:
1 parent
1992c35a25
commit
2c635989d2
2 files changed
+3
No files matched your search
@@ -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