mirror of
https://github.com/python-pillow/Pillow.git
synced 2024-12-26 18:06:18 +03:00
Merge pull request #4608 from radarhere/numpy
This commit is contained in:
commit
4363507d16
|
@ -89,6 +89,11 @@ def test_3d_array():
|
||||||
assert_image(Image.fromarray(a[:, :, 1]), "L", TEST_IMAGE_SIZE)
|
assert_image(Image.fromarray(a[:, :, 1]), "L", TEST_IMAGE_SIZE)
|
||||||
|
|
||||||
|
|
||||||
|
def test_1d_array():
|
||||||
|
a = numpy.ones(5, dtype=numpy.uint8)
|
||||||
|
assert_image(Image.fromarray(a), "L", (1, 5))
|
||||||
|
|
||||||
|
|
||||||
def _test_img_equals_nparray(img, np):
|
def _test_img_equals_nparray(img, np):
|
||||||
assert len(np.shape) >= 2
|
assert len(np.shape) >= 2
|
||||||
np_size = np.shape[1], np.shape[0]
|
np_size = np.shape[1], np.shape[0]
|
||||||
|
|
|
@ -2751,7 +2751,7 @@ def fromarray(obj, mode=None):
|
||||||
if ndim > ndmax:
|
if ndim > ndmax:
|
||||||
raise ValueError("Too many dimensions: %d > %d." % (ndim, ndmax))
|
raise ValueError("Too many dimensions: %d > %d." % (ndim, ndmax))
|
||||||
|
|
||||||
size = shape[1], shape[0]
|
size = 1 if ndim == 1 else shape[1], shape[0]
|
||||||
if strides is not None:
|
if strides is not None:
|
||||||
if hasattr(obj, "tobytes"):
|
if hasattr(obj, "tobytes"):
|
||||||
obj = obj.tobytes()
|
obj = obj.tobytes()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user