[英]Incorrect red pixel values of saved picture Python
I have a multidimensional array of the red pixels in the picture. 我有一个图片中红色像素的多维数组。 And I'm adjusting it to make a new picture using the new red pixels that I have changed. 而我正在调整它以使用我已更改的新红色像素制作新照片。 I'm still keeping the blue and green and I'm not changing those. 我仍然保持蓝色和绿色,我不会改变它们。 When I print out the red pixels to see if their correct before I saved the new picture everything is right Until I actually check the new picture by opening and displaying the red values thats when the values are wrong. 当我在保存新图片之前打印出红色像素以查看它们是否正确时,一切都是正确的直到我实际检查新图片时打开并显示值错误时的红色值。 Heres the code: 下面是代码:
from PIL import Image
import numpy as np
picture = Image.open('flower.jpg')
red, green, blue = np.array(picture).T
print red
picture.save('output.jpg')
The output of the first print statement the red pixels of picture: 第一个print语句的输出是图片的红色像素:
[[112 114 111 ..., 12 13 7]
[111 112 112 ..., 13 15 11]
[111 110 110 ..., 12 17 17]
...,
[181 180 180 ..., 25 17 11]
[180 181 182 ..., 18 14 9]
[179 179 179 ..., 13 14 15]]
PIL保存的JPEG总是有损的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.