import imghdr
from PIL import Image
import os
file_path=os.getcwd()
for x in os.walk(file_path):
for y in x[2]:
if imghdr.what(y):
os.rename(y,y.split('.')[0]+'.'+imghdr.what(y))
import imghdr
from PIL import Image
import os
file_path=os.getcwd()
for x in os.walk(file_path):
for y in x[2]:
if imghdr.what(y):
os.rename(y,y.split('.')[0]+'.'+imghdr.what(y))
本文标题:python检测图片真实格式并修改
本文链接:https://www.haomeiwen.com/subject/vnconctx.html
网友评论