The imghdr
module identifies different image file formats. The current
version identifies bmp
, gif
,
jpeg
, pbm
,
pgm
, png
,
ppm
, rast
(Sun raster),
rgb
(SGI), tiff
, and
xbm
images. Example 9-1 demonstrates.
import Image im = Image.open("samples/sample.jpg") print im.format, im.mode, im.size
3.128.226.121