""" 字符串转换为图片,图片转换成字符串,二进制数据转换成内存中的图片 """ import base64 from io import BytesIO picstring = b'iVBORw0KGgoAAAANSUhEUgAAAFUAAABGCAYAAAC9t9hvAAAEVUlEQVR4nO2aS24iMRCGy9GojwK5xKwyV4gihU2kSKxyiblGVmxgFOUKM6tcApibsPEsghnj9qPKLpfdkF9CUZrG7f74XQ83Cq5A89eD9h3fLQdV43pVBu1JIaC2uOHecA42VWHAU3TRTvXB2r29j897uP//PoNrr8qpPqCx47n6xjrahGXAzl8PutSt2VDdpVUrk0pr9/ZeDBYFNRbIT0vnbh0O9n8WTYDvloPiTkIYRaEG6ztqDHKBN4KMValbvR/CZs1iCcAdhSnKfWTOb+TUoklQZRzcq3Pv1jpnbmcllShQW7F4PEGdoDYDanS31jXgFlclGXO6AeBv04pU2bV291RLN2JJiSJmsNI19FW1qUa13eqFKrFEkipw6/z1oO0XgKxbr6L3l84ZweXfhVsrqub9RWPq/OG+LdyJ1q8KgLY8xCuDzG6Lte4mzuF0cm7cEYHMALYJVHcStZR1cwV7AyxgS6CGJsMlSbfYKgZLvHawpLLrOg7A0rGYzRQZXyb5AzmTZQFKuLnUHNHzyVwdVboMtgThCnmTqcw/f7hPz6sg3LD3/j3seNmhywevJlAAZqglQFFNRkYz0KJ5Yev9qUDdm+VOZNlPUhke7bDE1NIlTwaakbRQ12B6VtZ8PzXLoYkw4G77AciGAfGtv9o/cMju+Rmf6Io4dbcclHmxlVsBt2ZtRjM/ImdxarPfUQWey1NXgx4Ada464HKQaEx1bzQW5yRioP5YgP5Y4M8fQGO+AFGHVdu3tdyKeTrsA6m+r0fHYsBjrr2MZ1THMJBKUi4kH0jf+/pjAbA6f08DaPXoB3sZUAFGicsGmoKpfz+OhlM/NqCfj5979l9Sbz5DgQu3qx+GkQr10BjHWGzGwLjTBxUAAH7h8dhgmxf/RlyFuqlEsEnIBXo7m8HtbJZ9fYCOnIpNYlgXh4CmnGqAbn/+RV3nbOyjW7txKkaUsBBKQin3bvd72O73pHm5Yk9Ubh2HLZhr6Cx7x86zk1KB9OazImCDGiqKzfEU3FBXVmOfwEA+QWcAakts+WO7kRqKhQJKR4WR3oAWj6klcKfy+y625a8OoCiwsGHBlQt2+zIkO6MSuYW9KfhjYnVqTlJKOXf7MgSPh94bXSOVqALtZujc1Pmsmbk0ZpovJXcc6qaIfU0AvwtDAGOOZYHaKgFxyF1dHGCLl/+UgfrkAxiCd/m7VBkK5QBKjPWp2KnqAKpl19Ravi+AtaQCmE44OM3XWdqlLgVghDoVmEaYehMr9QjK3rC+zpi6Ov+Xw522uoEqFj5W40PcIaB6gkE90vUkuhpwQ3HUe24B2KpQc4FSPu/V6vj3aXwdGyj3sj+NW2NQoxgUShmGgrsKHH/yt6K1gAI0gpq78YI6ceW5HkOXRJEoVK4mIce5BlYqnnYPtQdR69EvqEhJuPNsPM7BehXFrRyAJ/XcX0Ic7esXVI9KwXbTptYStgVl3WDhGqhXSXRQrv4BmLpo1UgpUgUAAAAASUVORK5CYII=' imagedata = base64.b64decode(picstring) #将二进制字符串(图片)decode为图片
如需要查看完整代码,请
需要浏览更多吗?
成为会员后,登陆才能继续浏览!联系微信scratch8即可办理会员。
(会员专属:能浏览所有文章,下载所有带链接的Python资源。)