PIL.Image.open() Opens and identifies the given image file.
This is a lazy operation; this function identifies the file, but the file remains open and the actual image data is not read from the file until you try to process the data (or call the load () method). See new ().
Syntax: PIL.Image.open (fp, mode = `r`)
fp - A filename (string), pathlib.Path object or a file object. The file object must implement read (), seek (), and tell () methods, and be opened in binary mode.
mode - The mode. If given, this argument must be “r”.
Returns type : An image object.
Raises : IOError - If the file cannot be found, or the image cannot be opened and identified.
Output: .JPG image extension open.
Another example: here we used the .PNG file extension.
Output: .PNG image extension is open.