[Tutor] [tutor] Problem in saving image file which is modified by ImageEnhance

Kent Johnson kent37 at tds.net
Sun Feb 10 14:24:20 CET 2008


Varsha Purohit wrote:
> Hello All,
>          I am using PIL function to change brightness of an image. But i 
> am getting an error when i am trying to save that image. Here is the code..
> 
> import Image
> import ImageChops, ImageEnhance
> import math, operator
> 
> file1 = Image.open("r10001t0.jpg")
> file2 = Image.open("r10001t1.jpg")
> 
> diff = ImageChops.difference(file1,file2)
> 
> enhancer = ImageEnhance.Brightness(diff)

This creates an ImageEnhance.Brightness instance. Then you need 
something like
enhanced = enhancer.enhance(2.0)

after which enhanced is the enhanced image that you should save.

Kent


More information about the Tutor mailing list