我正在使用Python,我有一个base64字符串。
我想知道我收到的base64数据是否是图像而不是任何其他文件(例如。PDF,DOCX(,其扩展名更改为图像扩展名。
例:
string1 = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAARwAAAD2CAYAAAAEXDiwAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAhdEVYdENyZWF0aW9uIFRpbWUAMjAyMDowMToyMyAxODowNjo1NkXosZcAADekSURBVHhe7Z0HuF5VlbDXDSUI0hOQIAqY0EWwjBLEwRFGKXYEQUT8FZixAjP4/4wFpTgqCAErYKFXHVBpCgiIBnQcVCIJkCCggEASgqEmQvJ/77n3/bJyuKE4zIEw64X97L3XXm3vc86+5ztfycD8HlEURfE0cu+99w21FmbEUF0URfE/Tm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0Rm04RVF0xsCf/3z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ylnWP4yzbEtBZzEseUm4f9rE9tMY7Xf/+rDQw0gqHAWY6Mvs4cz8mCJwhj6qvjrbQHUN+gP9GnfrChNo72yNptsE0+gsy5gHa55NyMrz5tim10bGMnyNVVHx/6gZxD1vFEEMazTH109Z99AP3sg7bHJdsho0aODWPaak+tb8aMRVEXO231TxvoS5aD5wNQezFnmDs+zFF99bJPc6VP0UZouw5grvo0V2rt9KVOjkFt33FwLPsAdXmeh8z45gO0GdMGnXxu0VdGDerqS79ZbkwKfeUW5MbGXj3l+tTOcXXNxfVlTH11PN69/gJnkNsoUkCngA7ObVtcCH1YgxOSrKMNBb0MMu28SMSc1Mn26lkzrj5tigcTHdr6zza2sy0Yx3VQl5J11aPWF6iLvbbY5XUlJw6UfizoDZePfoQ2Mkt7rI16YAyKMv2B8ahzHP2q164BHeaW9a0Bn+AcqY0n6OfY2Q8l5w3IvGOg7bkK+qYYG7Kc45LzyTXjOb619rTRtQC5IHecOvvNMu2pAbl5KoPsS2h7jimnxp919tH2pw16gk4+Ty2uafY"
String1是一个有效的 PNG 文件,其中AS String2不是扩展名已更改为PNG并上传的有效图像。
有什么想法吗?
PNG 格式有一个固定的标头,由 8 个字节组成,89 50 4e 47 0d 0a 1a 0a
转换为 base64 时,如下所示:
iVBORw0KGgo=
如您所见,它以填充字符"="结尾,该字符在图像的真实 base64 表示中不存在,并且根据标头后面的字节,可能会有不同的字符代替"o"。
因此,通过将 base64 字符串的第一个字符与
iVBORw0KGg
此原则适用于所有具有固定标头的文件格式。
借助此功能,我检查了 3 件事:
- 检查 base64 图像字符串验证
- 检查我要支持的图像格式
- 检查图像尺寸
法典:
import base64
import io
from PIL import Image
def is_valid_base64_image(self, image_string):
# checking valid base64 image string
try:
image = base64.b64decode(image_string)
img = Image.open(io.BytesIO(image))
except Exception:
raise Exception('file is not valid base64 image')
# end of check base64 image string
# checking image format I want to support
if img.format.lower() in ["jpg", "jpeg", "png"]:
# if you need to check image dimension
width, height = img.size
if width < 800 and height < 800:
return True
else:
raise Exception(
'image size exceeded, width and height must be less than 800 pixels')
# end of checking dimentions
else:
raise Exception('Image is not valid, only 'base64' image (jpg, jpeg, png) is valid')
# end of checking image format