在python中,模块对图像格式提供了支持
该模块主要是处理识别图像的格式
模块提供的函数如下:
imghdr.what(filename,h= Tests the image data contained the file named by filename, returns a string describing the image type. If optional h provided,t he filename ignored h assumed to contain the byte stream to test.
A list of functions performing the individual tests. Each function takes two arguments: the byte-stream an open file-like object. When what() called with a byte-stream,the file-
The test function should a string describing the image type the test succeeded, None it failed.
IMG_PATH =
= [
(
IMG_PATH =
img_ext = (
== main()
运行效果:
the image : [C:\test\hongten.jpg], the type :[jpeg]