zoukankan      html  css  js  c++  java
  • MarkDown 插入图片 && Picture To Base64

    MarkDown 插入图片 && Picture To Base64

    插入图片

    1. 本地插入图片

      不好分享, 本地图片路径更改和丢失, 都会导致图片无法加载

      ![text](/home/picture/0.png)
      
    2. 插入网络图片

      插入网络链接即可, 需将图片先上传至图床.
      ![text](http://xxxxxxx)
      
    3. 插入图片的Base64码

      ![text](data:image/png;base64,iVBORwo...)
      
      base64字符串过于长, 可在末尾设置一个id来调用
      ![text][id_0]
      [id_0]:data:image/png;base64,iVBORwo...
      

    Picture to Base64

    1. 一些在线网站即可将Picture转Base64
      https://tool.chinaz.com/tools/imgtobase

    2. Python代码

      import 
      """
          Picture to Base64
      """
      file = open('/home/picture/0.png', 'rb') # 二进制只读方式打开文件  
      base_file = base64.b64encode(file.read())  
      file.close()
      txt = open('/home/picture/0.txt', 'wb') 
      txt.write(str(base_file))
      txt.clost()
      
      """
          Base64 to Picture
      """
      base_file = 'fasDWkkS.....'
      imgData = base64.b64decode(base_file)
      file = open('/home/picture/1.png', 'wb')
      file.write(imgData)
      file.close()
  • 相关阅读:
    TypeScript--变量
    TypeScript--Hello
    前端跨域的方式
    内存泄漏与垃圾回收机制
    前端拷贝
    React生命周期16版本
    Redux三大原则
    IE6常见CSS解析Bug及hack
    Redux的应用
    vue-router-基础
  • 原文地址:https://www.cnblogs.com/willwuss/p/13662046.html
Copyright © 2011-2022 走看看