diff --git a/image_proc.py b/image_proc.py index 7d54ad5..29985c6 100644 --- a/image_proc.py +++ b/image_proc.py @@ -166,9 +166,10 @@ def gaussianNoisy(im, mean=mean, sigma=sigma): return im img = np.asarray(image) - width, height = img.shape + height, width = img.shape[:2] + channels = 1 if img.ndim == 2 else img.shape[2] img = gaussianNoisy(img[:].flatten(), mean, sigma) - img = img.reshape([width, height]) + img = img.reshape([height, width, channels]) return Image.fromarray(np.uint8(img))