Sorry, I looked to quickly to your code. Your mistake is that you are mixin
images and enhancers. For clarity I marked every image object with the suffix
'_im':
import Image
import ImageFilter
import ImageEnhance
file2 = "xyz.jpg"
im = Image.open(file2)
enhancer = ImageEnhance.Brightness(im)
bright_im = enhancer.enhance(0.5) #any value you want
sharp_im = bright_im.filter(ImageFilter.SHARPEN)
sharp_im.save("xyz1.jpg",quality=100)
From the documentation:
All enhancement classes implement a common interface, containing a single
method:
enhancer.enhance(factor) => image
Returns an enhanced image. The factor is a floating point value controlling the
enhancement. Factor 1.0 always returns a copy of the original image, lower
factors mean less color (brightness, contrast, etc), and higher values more.
There are no restrictions on this value.
http://www.pythonware.com/library/pil/handbook/imageenhance.htm
Varsha purohit schreef:
Hi Stani,
But i have enhanced the image with variable name ench1. So will the
image be effected ??
thanks,
On Jan 11, 2008 2:16 PM, Stani <[EMAIL PROTECTED]> wrote:
You have to save the image, so replace your last line with:
img2.save("xyz1.jpg",quality=100)
Stani
Varsha purohit schreef:
Hello All,
I have written a program using ImageEnhance module of pil where i
am
controlling brightness and contrast of the image but i am unable to use
im.save method to save the file. My code is here :
import Image
import ImageFilter
import ImageEnhance
file2 = "xyz.jpg"
img2 = Image.open(file2)
ench = ImageEnhance.Brightness(img2)
ench1 = ench.filter(ImageFilter.SHARPEN)
ench.save("xyz1.jpg" + ext, "JPEG", quality=100)
It says Brightness doesnt have attributes save and filter ?
Than how can i save the enhanced image... any ideas...
------------------------------------------------------------------------
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig
_______________________________________________
Image-SIG maillist - Image-SIG@python.org
http://mail.python.org/mailman/listinfo/image-sig