网上较小的图片一般都用base64编码进行传输,特别是一些网站的扫码登陆二维码。
配合该段代码,直接扫码即可。
# -*- coding:utf-8 -*-
# @FileName :testShowBase64IMG.py
# @Time :2022/5/27 14:22
import base64
import skimage.io
import cv2 as cv
class Main():
def __init__(self):
pass
def main(self):
print("hello python!")
base64img ='iVBORw0KGgoAAAANSUhEUgAAAH0AAAB9AQAAAACn+1GIAAAByklEQVR4Xr2VMY7lIAyGjSjokgsgcQ13XCm5wCS5QHIlOq6BlAvkdRQIr+HN6O1WZpuJUqBPCrZ//3aA/n0y/A6oAHOmK967oR30EPB0GlexALqL7iGA+gRYQ5oMnTAMkHZv53D/B/CgAqzxc4cAOFMsG9k1f1IXAMCE99nfH4EE0KWmI9jJu676AMgFTFq5Mg8LuBFQ0T1eV0xb1kdseYiAsjsNq84luiv0sBKo3i6YVrqPmFToAsmgqFBWYu3dboYAxbRFu+X7yPrxQ6BCmaPmr48WuVtbBIYqsh3cg/rI7Q4RUKQd9RXTYuALm4QyILsRAJeYy9bCyqAC7caqfL8oqdiLEwFShbR4vuk7dRGwhKqZjR3EEjZLySDcFe2E9Hir4hDg3rLqFxUV+TAGIK1RExXgO8IQoMjGsVsoCzZVxgDwcQ6O53vu0yACdpCiNtPVO/bdCCCCLw7Lw8o+ao2SQTXuyuwgxxsR+pYSATeJfbqxu1HXPkAiaFsK0kygsj5NT10EvAu9e5GdDDd5DPAohLZyFp/eqQ+BNhB2Jv2Y1uwRcBp6sfCG832HlYCnizSr2OUfA+1P6B5gU+gH3xIKoO31v55fAn8AgnuZPZMcP7cAAAAASUVORK5CYII='
imgdata = base64.b64decode(base64img)
img = skimage.io.imread(imgdata, plugin='imageio')
cv.imshow("Login", img)
cv.waitKey()
if __name__ == "__main__":
main = Main()
main.main()