首页 > 分享 > python实现图片变亮或变暗的方法分析

python实现图片变亮或变暗的方法分析

最新推荐文章于 2024-10-15 08:47:43 发布

googler_offer 于 2019-06-17 15:21:45 发布

版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

python实现图片变亮或变暗是如何来实现的呢?下面的内容将会通过具体的实例来演示python实现图片变亮或变暗的实现方法及相关技巧:

import Image

# open an image file (.jpg or.png) you have in the working folder

im1 = Image.open("angelababy.jpg")

# multiply each pixel by 0.9 (makes the image darker)

# works best with .jpg and .png files, darker < 1.0 < lighter

# (.bmp and .gif files give goofy results)

# note that lambda is akin to a one-line function

im2 = im1.point(lambda p: p * 0.5)

# brings up the modified image in a viewer, simply saves the image as

# a bitmap to a temporary file and calls viewer associated with .bmp

# make certain you have associated an image viewer with this file type

im2.show()

# save modified image to working folder as Audi2.jpg

im2.save("angelababy2.jpg")

相关知识

python基于Django的花卉商城系统设计与实现
Python时间序列分析入门指南:季节性调整方法
(开题)flask框架花卉艺术交流平台设计与实现(程序+论文+python)
Python实现NIKE耐克女REACT跑步鞋数据分析和可视化
卷积神经网络实现鸢尾花数据分类python代码实现
python数据分析与展示
(开题)flask框架仓库物流信息管理系统设计和实现(程序+论文+python)
基于Python爬虫的电商网站彩妆数据的分析与研究
Python毕业设计选题:基于django+vue的网上购物系统的设计与实现
Python项目:基于django+python的鲜花培育专家系统

网址: python实现图片变亮或变暗的方法分析 https://m.huajiangbk.com/newsview768398.html

所属分类:花卉
上一篇: 鱼塘水质过肥变绿怎么处理?
下一篇: 君子兰害怕遇到5件事,初学者经常