在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]

dawei

【声明】:淮南站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。