代码如下:

# -*- coding: utf-8 -*-
# Nola
"""
img2html : Convert image to HTML

optional arguments:
  -b #RRGGBB, --background #RRGGBB  background color (#RRGGBB format)
  -s (4~30), --size (4~30)          font size (int)
  -c CHAR, --char CHAR              characters
  -t TITLE, --title TITLE           html title
  -f FONT, --font FONT              html font
  -i IN, --in IN                    要转换的图片
  -o OUT, --out OUT                 输出文件名
$ img2html -i timg.jpg -o timg_html.html
"""
from img2html.converter import Img2HTMLConverter

converter = Img2HTMLConverter(char='',title='金木研')
html = converter.convert('timg.jpg')
with open('timg_html.html',mode='w',encoding='utf-8') as f:
    f.write(html)

  原图 VS 网页:

  

  

   安装img2html:

  

 

posted on 2019-03-28 18:41  落叶虽美只活一世  阅读(1062)  评论(0编辑  收藏  举报
Live2D