图片加密程序

    xiaoxiao2022-07-07  165

    文章目录

    程序结果

    程序

    #coding-utf-8 #author:石金雨 import base64 def convert_image(): # Picture ==> base64 encode with open('psb.jpg', 'rb') as fin: image_data = fin.read() base64_data = base64.b64encode(image_data) fout = open('wl.txt', 'w') fout.write(base64_data.decode()) fout.close() # base64 encode ==> Picture with open('psb.txt', 'r') as fin: base64_data = fin.read() ori_image_data = base64.b64decode(base64_data) fout = open('psb2.jpg', 'wb') fout.write(ori_image_data) fout.close() if __name__ == '__main__': convert_image()

    结果

    最新回复(0)