• <i id='n9GL7'><tr id='n9GL7'><dt id='n9GL7'><q id='n9GL7'><span id='n9GL7'><b id='n9GL7'><form id='n9GL7'><ins id='n9GL7'></ins><ul id='n9GL7'></ul><sub id='n9GL7'></sub></form><legend id='n9GL7'></legend><bdo id='n9GL7'><pre id='n9GL7'><center id='n9GL7'></center></pre></bdo></b><th id='n9GL7'></th></span></q></dt></tr></i><div id='n9GL7'><tfoot id='n9GL7'></tfoot><dl id='n9GL7'><fieldset id='n9GL7'></fieldset></dl></div>
  • <small id='n9GL7'></small><noframes id='n9GL7'>

  • <legend id='n9GL7'><style id='n9GL7'><dir id='n9GL7'><q id='n9GL7'></q></dir></style></legend><tfoot id='n9GL7'></tfoot>

          <bdo id='n9GL7'></bdo><ul id='n9GL7'></ul>

        如何将base64字符串转换为图像?

        How to convert base64 string to image?(如何将base64字符串转换为图像?)
          <bdo id='jEdVn'></bdo><ul id='jEdVn'></ul>
        • <i id='jEdVn'><tr id='jEdVn'><dt id='jEdVn'><q id='jEdVn'><span id='jEdVn'><b id='jEdVn'><form id='jEdVn'><ins id='jEdVn'></ins><ul id='jEdVn'></ul><sub id='jEdVn'></sub></form><legend id='jEdVn'></legend><bdo id='jEdVn'><pre id='jEdVn'><center id='jEdVn'></center></pre></bdo></b><th id='jEdVn'></th></span></q></dt></tr></i><div id='jEdVn'><tfoot id='jEdVn'></tfoot><dl id='jEdVn'><fieldset id='jEdVn'></fieldset></dl></div>

            1. <tfoot id='jEdVn'></tfoot>
            2. <legend id='jEdVn'><style id='jEdVn'><dir id='jEdVn'><q id='jEdVn'></q></dir></style></legend>
                    <tbody id='jEdVn'></tbody>

                  <small id='jEdVn'></small><noframes id='jEdVn'>

                  本文介绍了如何将base64字符串转换为图像?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我正在将图像转换为 base64 字符串并将其从 android 设备发送到服务器.现在,我需要将该字符串改回图像并将其保存在数据库中.

                  I'm converting an image to base64 string and sending it from android device to the server. Now, I need to change that string back to an image and save it in the database.

                  有什么帮助吗?

                  推荐答案

                  试试这个:

                  import base64
                  imgdata = base64.b64decode(imgstring)
                  filename = 'some_image.jpg'  # I assume you have a way of picking unique filenames
                  with open(filename, 'wb') as f:
                      f.write(imgdata)
                  # f gets closed when you exit the with statement
                  # Now save the value of filename to your database
                  

                  这篇关于如何将base64字符串转换为图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Initialize Multiple Numpy Arrays (Multiple Assignment) - Like MATLAB deal()(初始化多个 Numpy 数组(多重赋值) - 像 MATLAB deal())
                  How to extend Python class init(如何扩展 Python 类初始化)
                  What#39;s the difference between dict() and {}?(dict() 和 {} 有什么区别?)
                  What is a wrapper_descriptor, and why is Foo.__init__() one in this case?(什么是 wrapper_descriptor,为什么 Foo.__init__() 在这种情况下是其中之一?)
                  Initialize list with same bool value(使用相同的布尔值初始化列表)
                  setattr with kwargs, pythonic or not?(setattr 与 kwargs,pythonic 与否?)

                    1. <i id='uIxrl'><tr id='uIxrl'><dt id='uIxrl'><q id='uIxrl'><span id='uIxrl'><b id='uIxrl'><form id='uIxrl'><ins id='uIxrl'></ins><ul id='uIxrl'></ul><sub id='uIxrl'></sub></form><legend id='uIxrl'></legend><bdo id='uIxrl'><pre id='uIxrl'><center id='uIxrl'></center></pre></bdo></b><th id='uIxrl'></th></span></q></dt></tr></i><div id='uIxrl'><tfoot id='uIxrl'></tfoot><dl id='uIxrl'><fieldset id='uIxrl'></fieldset></dl></div>
                        <tbody id='uIxrl'></tbody>

                      <legend id='uIxrl'><style id='uIxrl'><dir id='uIxrl'><q id='uIxrl'></q></dir></style></legend>

                      • <tfoot id='uIxrl'></tfoot>

                        <small id='uIxrl'></small><noframes id='uIxrl'>

                        • <bdo id='uIxrl'></bdo><ul id='uIxrl'></ul>