【发布时间】:2018-05-07 13:25:04
【问题描述】:
import numpy
from PIL import Image
import binascii
def getMatrixfrom_bin(filename,width):
with open(filename, 'rb') as f:
content = f.read()
...
return fh
filename = "path\bin_filename(1)"
im = Image.fromarray(getMatrixfrom_bin(filename,512))
//getMatrixfrom_bin () is a function that generates a matrix from the binary bytes
im.save("path\bin_filename(1).png")
上面的代码一次只能生成一张图片,现在我需要把路径下的所有二进制文件都转换成图片,怎么办?
【问题讨论】:
标签: python image python-2.7 numpy image-processing