国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > Python > 正文

python實現(xiàn)圖片變亮或者變暗的方法

2019-11-25 17:20:39
字體:
供稿:網(wǎng)友

本文實例講述了python實現(xiàn)圖片變亮或者變暗的方法。分享給大家供大家參考。具體實現(xiàn)方法如下:

import Image# open an image file (.jpg or.png) you have in the working folderim1 = 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 functionim2 = 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 typeim2.show()# save modified image to working folder as Audi2.jpgim2.save("angelababy2.jpg")

運行效果如下所示:

希望本文所述對大家的Python程序設(shè)計有所幫助。

發(fā)表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發(fā)表
主站蜘蛛池模板: 定兴县| 隆化县| 宣化县| 石屏县| 内丘县| 丹东市| 长岭县| 扶绥县| 桑植县| 凌海市| 天柱县| 天长市| 华亭县| 新郑市| 南城县| 江北区| 民乐县| 班玛县| 宜昌市| 疏勒县| 化州市| 晋州市| 林州市| 陆丰市| 天门市| 儋州市| 江源县| 仙游县| 科尔| 嘉善县| 资源县| 荆门市| 洛浦县| 宜宾县| 游戏| 桓台县| 肇州县| 平昌县| 和林格尔县| 稷山县| 舞阳县|