MCPcopy Create free account
hub / github.com/PyWavelets/pywt / array2image

Function array2image

demo/image_blender.py:63–69  ·  view source on GitHub ↗

NumPy array to PIL Image

(arr, mode)

Source from the content-addressed store, hash-verified

61
62
63def array2image(arr, mode):
64 """NumPy array to PIL Image"""
65 arr = arr.swapaxes(1, 2).swapaxes(0, 2)
66 arr[arr < 0] = 0
67 arr[arr > 255] = 255
68 arr = numpy.fix(arr).astype(numpy.uint8)
69 return Image.frombytes(mode, arr.shape[1::-1], arr.tobytes())
70
71
72def load_image(path, mode=None, size=None):

Callers 1

blend_imagesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected