2000字范文,分享全网优秀范文,学习好帮手!
2000字范文 > 基于python的图像格式转换(将RGB图像转换为灰度图像)

基于python的图像格式转换(将RGB图像转换为灰度图像)

时间:2020-06-22 20:52:39

相关推荐

基于python的图像格式转换(将RGB图像转换为灰度图像)

1.将RGB图像转换为灰度图像:

from PIL import ImageI = Image.open('F:\\pycharm\\picture_format\\data\\lena.jpg')I.show()L = I.convert('L')L.show()

输出图像结果图为:

2.将RGB图像转换为1模式图像:

from PIL import ImageI = Image.open('F:\\pycharm\\picture_format\\data\\lena.jpg')I.show()L = I.convert('1')L.show()

输出结果图为:

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。