# -*- coding: utf-8 -*-
# @Time : 2022/1/14 9:35
# @Author : Cocktail_py
from PIL import Image
import imghdr
filename = 'xxx.jpg'
# 查看图片是什么类型
print(imghdr.what(filename))
# 转换成能打开的类型
image = Image.open(filename)
image = image.convert("RGB")
image.save(filename, "JPEG")
图片能预览但无法打开
最新推荐文章于 2024-06-14 09:50:01 发布