How to Check if a File is a Valid Image with Python
Python has many modules in its standard library. One that is often overlooked is imghdr which lets you identify what image type that is contained in a file, byte stream or path-like object.
The imghdr can recognize the following image types:
The Python Papers is a reader-supported publication. To receive new posts and support my work, consider becoming a …