Detecting if a file is an image in Python

Viewed 31868

Is there any general way to detect if a file is a image (jpg, bmp, png, etc...)

Or is making a list of the file extensions and doing a one-by-one comparison the only way?

2 Answers
Related