版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/littlle_yan/article/details/79204544
1.将RGB图像转换为灰度图像:
from PIL import Image
I = Image.open('F:\\pycharm\\picture_format\\data\\lena.jpg')
I.show()
L = I.convert('L')
L.show()
输出图像结果图为:
2.将RGB图像转换为1模式图像:
from PIL import Image
I = Image.open('F:\\pycharm\\picture_format\\data\\lena.jpg')
I.show()
L = I.convert('1')
L.show()
输出结果图为: