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

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

    1. <legend id='lBrMz'><style id='lBrMz'><dir id='lBrMz'><q id='lBrMz'></q></dir></style></legend>
      <tfoot id='lBrMz'></tfoot>
    2. 您如何对 PNG 图像进行 base-64 编码以在 CSS 文件中的 data-uri 中使用?

      时间:2023-10-01
          <tbody id='yM9eO'></tbody>
        <tfoot id='yM9eO'></tfoot>

          <bdo id='yM9eO'></bdo><ul id='yM9eO'></ul>
          1. <small id='yM9eO'></small><noframes id='yM9eO'>

              • <i id='yM9eO'><tr id='yM9eO'><dt id='yM9eO'><q id='yM9eO'><span id='yM9eO'><b id='yM9eO'><form id='yM9eO'><ins id='yM9eO'></ins><ul id='yM9eO'></ul><sub id='yM9eO'></sub></form><legend id='yM9eO'></legend><bdo id='yM9eO'><pre id='yM9eO'><center id='yM9eO'></center></pre></bdo></b><th id='yM9eO'></th></span></q></dt></tr></i><div id='yM9eO'><tfoot id='yM9eO'></tfoot><dl id='yM9eO'><fieldset id='yM9eO'></fieldset></dl></div>
                <legend id='yM9eO'><style id='yM9eO'><dir id='yM9eO'><q id='yM9eO'></q></dir></style></legend>
              • 本文介绍了您如何对 PNG 图像进行 base-64 编码以在 CSS 文件中的 data-uri 中使用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我想对 PNG 文件进行 base-64 编码,以将其包含在我的样式表中的 data:url 中.我该怎么做?

                I want to base-64 encode a PNG file, to include it in a data:url in my stylesheet. How can I do that?

                我在 Mac 上,所以 Unix 命令行上的东西会很好用.基于 Python 的解决方案也很棒.

                I’m on a Mac, so something on the Unix command line would work great. A Python-based solution would also be grand.

                推荐答案

                这应该在 Python 中完成:

                This should do it in Python:

                import base64
                encoded = base64.b64encode(open("filename.png", "rb").read())
                

                这篇关于您如何对 PNG 图像进行 base-64 编码以在 CSS 文件中的 data-uri 中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:使用 javascript 播放以 base64 编码的 .wav 声音文件 下一篇:如何下载 base64 编码的图像?

                相关文章

                1. <tfoot id='EFESL'></tfoot>
                2. <small id='EFESL'></small><noframes id='EFESL'>

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

                3. <legend id='EFESL'><style id='EFESL'><dir id='EFESL'><q id='EFESL'></q></dir></style></legend>

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