<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 中使用?

      How do you base-64 encode a PNG image for use in a data-uri in a CSS file?(您如何对 PNG 图像进行 base-64 编码以在 CSS 文件中的 data-uri 中使用?)
          <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 中使用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                相关文档推荐

                Scale background image to fit ie8 window(缩放背景图像以适合 ie8 窗口)
                @fontface in IE7 (IETEster) not working properly(IE7 (IETEster) 中的@fontface 无法正常工作)
                Safari 5.1 breaks CSS table cell spacing(Safari 5.1 打破 CSS 表格单元格间距)
                How to get file size of newly created Image() if src is base64 string?(如果 src 是 base64 字符串,如何获取新创建的 Image() 的文件大小?)
                How to delegate `hover()` function by using `on()`(如何使用 `on()` 委托 `hover()` 函数)
                How to center slider in css?(如何在css中居中滑块?)
                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>
                    <tbody id='EFESL'></tbody>

                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>