Python | PIL Attributes
Attribute defines the various property of an object, element or file. In the image, attribute refers to the size, filename, format or mode, etc. of the image.
Image used is:
Instances of the Image class have the following attributes:
PIL.Image.filename: The filename or path of the source file. Only images created with the factory function open have a filename attribute. If the input is a file-like object, the filename attribute is set to an empty string.
Syntax: PIL.Image.filename Type: py:class: string
PIL.Image.format: The file format of the source file. For images created by the library itself (via a factory function, or by running a method on an existing image), this attribute is set to None.
Syntax: PIL.Image.format Type: string or None
PIL.Image.mode: Image mode. This is a string specifying the pixel format used by the image. Typical values are “1”, “L”, “RGB”, or “CMYK.” See Modes for a full list.
Syntax: PIL.Image.mode Type: string
PIL.Image.size: Image size, in pixels. The size is given as a 2-tuple (width, height).
Syntax: PIL.Image.size Type: (width, height)
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning – Basic Level Course