2015-07-11 77 views
1

我使用枕头的一个项目,我真的想创建一个类似下面的图像的效果的图像的亮度,外观:使用低枕头

To Throw a chicken at oneself

在这张图片中,你看到像背景图片是不透明的,我不知道这是我需要使用的词。我想要做的是文本比背景图片更亮,这是一个很好的效果。

我可以在枕头中复制这种效果吗?如果是这样,功能是什么?万分感谢。我知道这是一个广泛的问题,但由于我不知道如何以正确的方式提出问题,我会接受任何会使我走向正确道路的建议。

PS。我发现在这张照片:http://qz.com/402739/the-best-idioms-from-around-the-world-ranked/

+0

见问题[?_Algorithm修改RGB图像亮度_](http://stackoverflow.com/questions/11163578/ algorithm-to-modify-brightness-for-rgb-image)建议将图像的每个R,G,B值乘以某个常数的答案对于使用Pillow通过Image.point()函数实现。建议将每个像素从RGB转换成HSL然后再转换回来的方法虽然可以实现,但使用它可能不切实际。 – martineau

回答

1

基于@martineau的评论

from PIL import Image 

im = Image.open('image-to-modify.jpg') 

source = im.split() 

R, G, B = 0, 1, 2 
constant = 1.5 # constant by which each pixel is divided 

Red = source[R].point(lambda i: i/constant) 
Green = source[G].point(lambda i: i/constant) 
Blue = source[B].point(lambda i: i/constant) 

im = Image.merge(im.mode, (Red, Green, Blue)) 

im.save('modified-image.jpeg', 'JPEG', quality=100)