Disappear in Python Image Module
2 answers
You can use the ImageEnhance PIL module :
import Image
import ImageEnhance
image = Image.open(r'c:\temp\20090809210.jpg')
enhancer = ImageEnhance.Brightness(image)
brighter_image = enhancer.enhance(2)
darker_image = enhancer.enhance(0.5)
Check out the PIL and ImageEnhance documentation for more details.
Note. I find the ImageEnhancer documentation is a bit too complicated and you might need some experimentation on the interactive prompt to get the right solution.
+7
source to share
If you want to do it in a complex way, i.e. code, change the pixel intensity by pixel. Here's how to do it: 1) Convert from RGB to HSI 2) Increase or decrease the intensity component 3) Convert from HSI to RGB
True attenuation, i.e. no alpha channel in JPG or BMP [RGBA image in PIL]. You get black to white using the intensity method. If you want to use the alpha version of png or tiff instead.
+1
source to share