0

Saving:

from PIL import Image
im = Image.fromarray(img) #img is a numpy array
im.save("./your_file.jpg")

Loading:

img2 = Image.open("./your_file.jpg")
img2 = np.array(img2)

Checking:

img2 == img

The results are that there are like 50% False. On inspection, the values are very close. Plotting both img and img2 basically looks the same (at least to my eye), but I am just posting this question up as I am wondering whether is this a bug or a feature in the PILLOW library?

Add-on: Loading with open-cv also gives a different array.

Noob
  • 19
  • 2

0 Answers0