Python Notes #2 - 1.21.2013
来源:互联网 发布:matlab画二维数组 编辑:程序博客网 时间:2024/05/18 07:13
[图片来自Nathan Barry的Instagram, http://instagram.com/nathanbarry/]
图片的操作:
import mediapath = media.choose_file()pic = media.load_picture(path)media.show(pic)for p in media.get_pixels(pic): new_blue = int(0.6 * media.get_blue(p)) new_green = int(0.6 * media.get_green(p)) media.set_blue(p, new_blue) media.set_green(p, new_green)media.show(pic)print pic.titlenew_name = raw_input("Enter the name to save the new file:")new_name += '.jpg'media.save_as(pic, new_name)print pic.title
将图片的每个像素的蓝色和绿色降低为原来的60%,以便让图片看起来更暗,更红些。像是在暮光下拍的。
Python Shell:
[evaluate sunset.py]
C:/Python27/nearFlorence.jpg
Enter the name to save the new file:nearFlorenceSunset
nearFlorenceSunset.jpg
- Python Notes #2 - 1.21.2013
- Python Notes #3 - 1.21.2013
- Python Notes (2)
- Python Notes #1 - 1.20.2013
- Python Notes
- Python notes
- Python Notes
- python notes
- Python notes
- Python Notes
- Python Notes
- Python Notes
- python notes
- python-notes
- Python Notes
- Python 3.3 Tutorial Notes - 2:Control Flow
- Notes of Python Learning 2/10/2016
- Python chapter 2&3 learning notes
- Linux中僵尸进程
- 理解装配中的文件引用-2
- Windows防火墙开启PING
- 重构一之将属性转化为值对象
- MFC 容易出错地方笔录
- Python Notes #2 - 1.21.2013
- Redis 或弃用当前 VM 机制,采用新的 diskstore 模型
- ABCUpload4.6之WIN7与WIN2008SERVER下的注册号破解
- User,Responsibility,Organization
- dp解决最大子矩阵问题
- su:认证失败 和linux终端下如何退出root权限
- Debian /etc/apt/sources.list 修改
- apt openssh-server
- Redis内存使用优化与存储