-1

I print a row of my output image and it is binary obviously enter image description here

However, when I read it in another function and print this row again, it becomes non-binary. What happened?

img = plt.imread(two_image,0)

print(img[100]) enter image description here

FOREST
  • 328
  • 1
  • 3
  • 11
  • 1
    jpg does some compression which loose information. You might want to use the png (or the gif) format. – JohanC Mar 14 '21 at 14:54

1 Answers1

1

You’re probably saving it as a JPEG file, which is a lossy format. It changes the data slightly to be able to reduce the size on disk. To avoid this, save it as a PNG file.

Cris Luengo
  • 55,762
  • 10
  • 62
  • 120