python-pillowHow to auto contrast an image
from PIL import Image, ImageOps
im = Image.open('/var/www/examples/heroine.png')
im = ImageOps.autocontrast(im, cutoff = 5)
im.show()ctrl + c| PILimport Pillow package modules | Image.openopen given image with Pillow | 
| /var/www/examples/heroine.pngpath to sample image to open | ImageOps.autocontrastset contrast automatically based on given cutoff | 
| cutoff = 5defines part of histogram (in percents) that should be removed | .show()displays resulting image | 
Usage example
from PIL import Image, ImageOps
im = Image.open('/var/www/examples/heroine.png')
im = ImageOps.autocontrast(im, cutoff = 5)
im.show()More of Python Pillow
- How to map image using point() method
- How to draw a point
- How to create image from an array
- How to change image opacity (transparency)
- How to draw a triangle
- How to draw rectangle
- How to set background color
- How to draw an arc
- How to add watermark to image
- How to get image size
See more codes...
