• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell
您的位置:首页 > 脚本语言 >python > python实现图片变亮或者变暗的方法

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

作者: 字体:[增加 减小] 来源:互联网

通过本文主要向大家介绍了python实现单例的方法,python实现人脸识别,python实现冒泡排序,python实现神经网络,python实现svm等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com

本文实例讲述了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")

</div>

运行效果如下所示:

希望本文所述对大家的Python程序设计有所帮助。

</div>

您可能想查找下面的文章:

  • python非递归全排列实现方法
  • python实现读取并显示图片的两种方法
  • python自动翻译实现方法
  • Python自动扫雷实现方法
  • Python实现模拟登录及表单提交的方法
  • Python自动扫雷实现方法
  • python实现计算倒数的方法
  • python实现计算倒数的方法
  • Python实现批量下载图片的方法
  • python实现自动登录人人网并采集信息的方法

相关文章

  • 详解Python中列表和元祖的使用方法
  • python使用opencv进行人脸识别
  • python3使用PyMysql连接mysql数据库实例
  • Python做简单的字符串匹配详解
  • python中self原理实例分析
  • NumPy统计函数的实现方法
  • Windows下python2.7.8安装图文教程
  • 使用Python写CUDA程序的方法
  • Python实现命令行通讯录实例教程
  • 整理Python最基本的操作字典的方法

文章分类

  • vbs
  • DOS/BAT
  • hta/htc
  • python
  • perl
  • VBA
  • ColdFusion
  • ruby
  • PowerShell
  • Lua
  • Golang
  • linux shell

最近更新的内容

    • python解析模块(ConfigParser)使用方法
    • python动态加载变量示例分享
    • Python将阿拉伯数字转换为罗马数字的方法
    • Python的Urllib库的基本使用教程
    • python实现复制整个目录的方法
    • Python编写简单的HTML页面合并脚本
    • 在主机商的共享服务器上部署Django站点的方法
    • Python 类的继承实例详解
    • 将Python代码打包为jar软件的简单方法
    • Python的条件语句与运算符优先级详解

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有