来自 118kjcom开奖现场直播 2019-11-28 16:22 的文章
当前位置: 118kj开奖现场 > 118kjcom开奖现场直播 > 正文

118kj开奖现场字节转换成图像

python 字节转换成图像

使用base64

1.图片转成字节使用:  base64.b64encode()

2.字节转成图片: base64.b64decode()

 

图片字节串:

iVBORw0KGgoAAAANSUhEUgAAAJYAAAAyCAYAAAC+jCIaAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAj3SURBVHhe7ZzRdeI6FEVTzWuD31TC13ymifSQBqgiX+kj08HrgMcFtny1ufIQYAgvy1prrzM6R7KFrRHGmDz9+8+v7cLCrdlPrCi/f/9uLPWlfk29TawcogYfNfiowUcNPmrwozw9PXU4p08GHzX4KHhfkNsE9EMNPmrwUYOPGnzU4KMGHzX4qMGP0k2sHI54lHx0kslH3DL3GEzuB7l/xU/JH2rF4oSMcvwo+QQGzumTwUcNPtsz5KjBRz3Girn+Bh81+KjBRw0+avBRgx+lTawoVaN71KuDnfOq7j7OL62fu/9b1f06Kub6P2q9W7EMjVGDjxp8NDM6gBn6oQYfNfiowUc9BnzU4KMGHzX4qMH3cTK0M/iowUcNPmrw0czsxApyp4/XVfnC1pvTfpD7B1X/nBv3N7fI58YRpfLhEfJ8LEdUfYMolQ+X5uetWJ9v21UMcPW6/Wj5ZvuSBr56/Wj9oPXflfwiIUpuZ/BRg48afNREyeOo8qwGHzX4qMFHDT5q8FGDH8XH3rgv/bIafDTTJpbDVv94PUyqp5ftRvlmnQb38t4y8jxwyLnb37v+aOP5zrrPU0Vu7/6udysWIRq0ybNbrT5P8s12fdxpvB3i58FA7ocafNTgowYfNfhRGNMod5Z91OCjBh81+KjBRw0+avBRg48an9OKaBelm1iY/DuYVqX1fsVynvFOAreZ6x9ckuf9VHkmSjUuiFL5sOTzOcf2/BVrz/P29aPPp2wi5xl81OCjBh8Nqv2iJsq9x5fBRw0+avBRg48afNTgowYfNfhR2sSKUjWarrHE8Zoqe2X/v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uhn1ynbWa3v+O78mXFSmrwUYOPGnzU4KMGHzX4qMFHDT5q8FGDj2baxFpYuC2/tv8BB256mb/wMqgAAAAASUVORK5CYII=

 

示例代码: 字节解码成图片

res为图片字节串

from PIL import Image
import base64
img = base64.b64decode(res)

file = open('test.jpg','wb')
file.write(img)
file.close()

 

本文由118kj开奖现场发布于118kjcom开奖现场直播,转载请注明出处:118kj开奖现场字节转换成图像

关键词: