【发布时间】:2019-12-06 23:08:22
【问题描述】:
>>> m1.putpixel((0,0),(1,2,3))
>>> asarray(m1)[0]
array([[ 1, 2, 3],
[ 1, 0, 252],
[ 1, 0, 252],
...,
[253, 0, 0],
[253, 0, 0],
[253, 0, 0]], dtype=uint8)
>>> m1.save('enc_png.jpg',"JPEG")
>>> m1 = Image.open('enc_png.jpg')
>>> asarray(m1)[0]
array([[ 0, 0, 211],
[ 0, 0, 219],
[ 1, 4, 231],
...,
[253, 0, 0],
[253, 0, 0],
[253, 0, 0]], dtype=uint8)
当我将图像保存为 jpg 时,像素从 (1,2,3) 变为 (0,0,211)。当我将它保存为 png 时,它工作正常。我该如何解决这个问题?
【问题讨论】:
标签: python image-processing python-imaging-library