本地图片作为输入进行图片分析,请问如何才能判断图片是否已经损坏,如何才能实现分析时自动检查,并将已经损坏的图片删除。。。
2条回答 默认 最新
- oyljerry 2017-03-28 04:20关注
用imghdr模块
https://docs.python.org/3/library/imghdr.html>>> import imghdr >>> imghdr.what('/tmp/bass')
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
本地图片作为输入进行图片分析,请问如何才能判断图片是否已经损坏,如何才能实现分析时自动检查,并将已经损坏的图片删除。。。
用imghdr模块
https://docs.python.org/3/library/imghdr.html
>>> import imghdr
>>> imghdr.what('/tmp/bass')