Pillow: Pillow Is An Image-Processing Library Used in Python Programs
Pillow is an image processing library for Python that provides APIs for common image processing tasks like geometric transformations, filtering, enhancement, color space conversion, and statistical analysis. It supports many image file formats and can open, save, display, resize, rotate, crop and more. Example code shows how to use Pillow for color transforms, filters, enhancement and creating animated GIFs.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
28 views
Pillow: Pillow Is An Image-Processing Library Used in Python Programs
Pillow is an image processing library for Python that provides APIs for common image processing tasks like geometric transformations, filtering, enhancement, color space conversion, and statistical analysis. It supports many image file formats and can open, save, display, resize, rotate, crop and more. Example code shows how to use Pillow for color transforms, filters, enhancement and creating animated GIFs.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 3
PILLOW
Pillow is an image-processing library used in Python
Programs. USAGE: If you are building your application with Python and need to add image processing features to it, there are various libraries you could use. Some popular ones are OpenCV, scikit-image, Python Imaging Library and Pillow. • Pillow has extensive APIs to support image processing which provide methods for Geometrical transformations • Image filtering • Image enhancement • Color space conversions of Images • Statistical analysis of images like histogram • It supports a range of image file formats such as PNG, JPEG, PPM, GIF, TIFF and BMP. Installation: $ pip install Pillow Methods and Attributes Image .open() Image.resize() Image.show() Image.rotate() Image.save() Image.transpose() Image.thumbnail() Image.convert() Image.filter() Image.crop() Image.point() Image.transpose() ImageEnhance.contrast() Image.paste() Image.format Image.merge() Image.size Image.split() Image.mode Example code Color Transforms from PIL import Image # Display individual frames from im = the loaded animated GIF file Image.open("peacock.jpg").convert("L") imageObject=Image.open('xmas.gif') im.show() images=[] for frame in Filters range(0,imageObject.n_frames): from PIL import ImageFilter im=Image.open('peacock.jpg') imageObject.seek(frame) out = im.filter(ImageFilter.DETAIL) images.append(imageObject) out.show() imageObject.show() # multiply each pixel by 1.2 out = im.point(lambda i: i * 1.2) #creating gif's out.show() images[0].save('anitest.gif', Enhancing image save_all=True, #Enhancing images append_images=images[1:], from PIL import ImageEnhance duration=100, enh = ImageEnhance.Contrast(im) loop=0) enh.enhance(1.3).show("30% more contrast")