[Chennaipy] Chennaipy - Monday Module - 08 Aug 2022
selvi dct
selvi.dct at gmail.com
Mon Aug 8 15:26:41 EDT 2022
Date: 08 Aug 2022
Module : Pillow
Installation : pip install Pillow
About:
The Python Imaging Library adds image processing capabilities to the Python
interpreter. This library provides extensive file format support, an
efficient internal representation, and fairly powerful image processing
capabilities. The core image library is designed for fast access to data
stored in a few basic pixel formats. It provides a solid foundation for a
general image processing tool.
Source:
from PIL import Image
# Location of the image
img = Image.open("image.jpg")
# Show the image
img.show()
# Size of the image
print(img.size)
# Format of the image
print(img.format)
# Rotating a image 90 deg counter clockwise
img = img.rotate(90, PIL.Image.NEAREST, expand = 1)
# Flip the original image vertically
img = img.transpose(method=Image.FLIP_TOP_BOTTOM)
# Setting the points for cropped image
left = 4
top = height / 5
right = 154
bottom = 3 * height / 5
# Cropped image of the given dimension
img = img.crop((left, top, right, bottom))
# Resize the image
newsize = (300, 300)
img = img.resize(newsize)
Reference:
https://pypi.org/project/Pillow/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.python.org/pipermail/chennaipy/attachments/20220809/d59b05b9/attachment.html>
More information about the Chennaipy
mailing list