I converted an image to numpy array using:
arr = np.array(PIL.Image.open('1.jpg'))
Then I modified part of the array:
arr[0][0][0] = 128
and converted the array back to an image:
img = PIL.Image.fromarray(np.uint8(arr))
im.save('2.jpg')
Then, I converted the 2.jpg image into numpy array and checked value of arr:
arr = np.array(PIL.Image.open('2.jpg'))
print(arr)
I am getting a completely different array than I got before. Why is this happening?