2015-07-11 122 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)