Win7,64位,Python中对图片进行 Base64 编码和解码

Base64,简单地讲,就是用 64 个字符来表示二进制数据的方法。这 64 个字符包含小写字母 a-z、大写字母 A-Z、数字 0-9 以及符号"+"、"/",其实还有一个 "=" 作为后缀用途,所以实际上有 65 个字符。

Python 内置了一个用于 Base64 编解码的库:base64:

编码使用 base64.b64encode()

解码使用 base64.b64decode()

1    对图片进行 Base64 编码和解码

import base64

def convert_image():

    # Picture ==> base64 encode

    with open('d:\\FileTest\\Hope_Despair.jpg', 'rb') as fin:

        image_data = fin.read()

        base64_data = base64.b64encode(image_data)

        fout = open('d:\\FileTest\\base64_content.txt', 'w')

        fout.write(base64_data.decode())

        fout.close()

    # base64 encode ==> Picture

    with open('d:\\FileTest\\base64_content.txt', 'r') as fin:

        base64_data = fin.read()

        ori_image_data = base64.b64decode(base64_data)

        fout = open('d:\\FileTest\\Hope_Despair_2.jpg', 'wb')

        fout.write(ori_image_data)

        fout.close() 

if __name__ == '__main__':

    convert_image()

2    对图片进行 Base64 编码和解码(Pythonic)

import base64

def convert_image():

      # Picture ==> base64 encode

    with open('d:\\FileTest\\Hope_Despair.jpg', 'rb') as fin, open('d:\\FileTest\\base64_content.txt', 'w') as fout:

        fout.write(base64.b64encode(fin.read()).decode())

    # base64 encode ==> Picture

    with open('d:\\FileTest\\base64_content.txt', 'r') as fin, open('d:\\FileTest\\Hope_Despair_2.jpg', 'wb') as fout:

        fout.write(base64.b64decode(fin.read()))

if __name__ == '__main__':

    convert_image()

import base64

#base_str1 = "data:image/jpg;base64,/9j/4AAQSkZJRgABAgAAAQABAAD/"

base_str= "/9j/4AAQSkZJRgABAgAAAQABAAD/2wBDAAgGBgcGBQgHBwcJCQgKDBQNDAsLDBkSEw8UHRofHh0aHBwgJC4nICIsIxwcKDcpLDAxNDQ0Hyc5PTgyPC4zNDL/2wBDAQkJCQwLDBgNDRgyIRwhMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjIyMjI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pg","wb")

file.write(img)

file.close()

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,839评论 6 482
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,543评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 153,116评论 0 344
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,371评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,384评论 5 374
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,111评论 1 285
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,416评论 3 400
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,053评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,558评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,007评论 2 325
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,117评论 1 334
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,756评论 4 324
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,324评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,315评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,539评论 1 262
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,578评论 2 355
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,877评论 2 345

推荐阅读更多精彩内容

  • rljs by sennchi Timeline of History Part One The Cognitiv...
    sennchi阅读 7,294评论 0 10
  • 晌午出门气温还算高,到达抚州就下起了毛毛细雨,风也冷冽了些,温度更是下降了很多。 开完会跟伙伴们交流了一下,而后便...
    飞舞de叶阅读 180评论 0 2
  • 第一章 分离 温暖的午后,我躺在卧室宽敞的窗台上,太阳照着我浑身暖洋洋的,我眯着眼,外面的一切我都看不清了,可是在...
    清如许_4a80阅读 194评论 0 0
  • 徘徊,徘徊,你站在心门之外。犹豫,犹豫,要不要把门打开?纠结,纠结,可不可以放你进来?爱,或许没有对错,但是一定会...
    简JN阅读 2,252评论 61 78