# File: imghdr-example-1.py import imghdr result = imghdr.what("samples/sample.jpg") if result: print "file format:", result else: print "cannot identify file"