python-3.x - 像素颜色强度
问题描述
import PIL
from PIL import Image
from PIL import ImageEnhance
from PIL import ImageDraw
# read image and convert to RGB
image=Image.open("readonly/msi_recruitment.gif")
image=image.convert('RGB')
# build a list of 9 images which have different brightnesses
enhancer=ImageEnhance.Brightness(image)
images=[]
for i in range(1, 10):
images.append(enhancer.enhance(i/10))
# create a contact sheet from different brightnesses
first_image=images[0]
contact_sheet=PIL.Image.new(first_image.mode, (first_image.width*3,first_image.height*3))
x=0
y=0
for img in images:
# Lets paste the current image into the contact sheet
contact_sheet.paste(img, (x, y) )
# Now we update our X position. If it is going to be the width of the image, then we set it to 0
# and update Y as well to point to the next "line" of the contact sheet.
if x+first_image.width == contact_sheet.width:
x=0
y=y+first_image.height
else:
x=x+first_image.width
# resize and display the contact sheet
contact_sheet = contact_sheet.resize((int(contact_sheet.width/2),int(contact_sheet.height/2) ))
display(contact_sheet)
这就是我得到的...... 上面的代码只是改变亮度......
此外,文本不会出现在底部,因为它应该......
请告诉我应该进行哪些更改以改变此代码和文本问题中的颜色强度.....请帮助并指出此代码中的更改...不胜感激!!!!
解决方案
推荐阅读
- java - TableLayout 在调整文本大小时调整视图大小,即使它是固定大小的
- c# - 当我修改DataGridView时,它给system.invalidoperationexception跨线程操作无效?
- c - 如何使用内联汇编将给定地址写入寄存器
- laravel-5 - 如何在需要时禁用或设置为空数组模型属性 $with 以不急于加载默认模型关系?
- hyperledger - What is the block time of Hyperledger Sawtooth PoET?
- android - 三星 Galaxy:正在运行的 Android 应用程序从后台堆栈列表中消失
- android - Android 中的 scrollToEnd - GraphView
- android - 附近的 AR POI 重叠
- javascript - 元视口根本不适用于我的网站
- java - 无法创建 SOAP 连接工厂:未找到提供程序 com.sun.xml.internal.messaging.saaj.client.p2p.HttpSOAPConnectionFactory