In my code, I am creating a RGB array (256 * 256 * 3) and I need to show it. I am having trouble creating a PIL image from a RGB array. I wrote this code to explain:
import numpy as np
from PIL import Image
image = Image.open('img_test.png')
image.thumbnail((256, 256))
image = image.convert("RGB")
image = np.asarray(image, dtype=np.float32) / 255
PIL.Image.fromarray(image, "RGB").show()
I am getting this image back:
If I am using
import matplotlib.pyplot as plt
plt.imshow(image)
plt.show()
What am I doing wrong with this line?
PIL.Image.fromarray(image, "RGB").show()

