python 中如何将RGB图像模式转为灰度

 时间:2024-10-11 20:37:48

1、安装pil扩展,如果没有安装。pip install pillow

2、安装后,直接引用from PIL import Image

3、img = Image.open(r'D:/cat.jpg')

4、grey = img.convert('L')参数L,代表灰度

5、grey.save('D:/grey.jpg')将转换后的灰度图像对象存储。

python 中如何将RGB图像模式转为灰度
  • 销售怎么找客户资料
  • int和Integer的区别
  • 如何在QQ群中分享图片
  • 丰胸四大招,坚持下来变D罩杯
  • 中国式幸福家庭的七要素
  • 热门搜索
    脸上长色斑怎么回事 没钱了怎么办 表格中的斜线怎么弄 浙江大学怎么样 没关系英语怎么说 电脑怎么开蓝牙 基本工资怎么算 苹果5s怎么刷机 怎么才能长胖 罗汉果怎么泡水