代码如下:

# -*- 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:

  

使用img2html把图片转为网页的更多相关文章

  1. BASE64编码的图片在网页中的显示问题的解决

    BASE64位转码有两种: 一种是图片转为Base64编码,这种编码是直接可以在页面通过<img src='base64编码'/>的方式显示 Base64 在CSS中的使用 .demoIm ...

  2. 将图片转为ASCII字符画

    原文:将图片转为ASCII字符画 Copyright 2012 Conmajia 源代码下载:点击这里 什么是字符画?就是用ASCII字符来近似组成图像,就像这样: ╭╮ ╭╮ ││ ││ ╭┴┴—— ...

  3. canvas将图片转为base64

    最简例子 <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <meta ...

  4. 011_如何decode url及图片转为base64文本编码总结

    一.咱们经常会遇到浏览器给encode后的url,如何转换成咱们都能识别的url呢?很简单,talk is easy,Please show me your code,如下所示: (1)英文decod ...

  5. 使用django发布带图片的网页(上)

    如何使用django发布带静态图片的网页呢? 在settings.py里加入下面内容 STATIC_ROOT = os.path.join(os.path.dirname(__file__),'sta ...

  6. png格式图片转为svg格式图片

    png格式图片转为svg格式图片 (2012-08-30 16:24:00) 转载▼ 标签: 杂谈 分类: linux 在ubuntu下将png格式的图片转换成svg格式步骤如下:1.安装 inksc ...

  7. js将图片转为base64编码,以字符串传到后台存入数据库

    (前台在中approve_edit.html中,后台不变) 链接参考:http://www.cnblogs.com/Strom-HYL/p/6782176.html 该链接文中并没有用到easyUI的 ...

  8. 上传图片时,使用GDI+中重绘方式将CMYK图片转为RGB图片

    原文:上传图片时,使用GDI+中重绘方式将CMYK图片转为RGB图片 我们知道,如果网站上传图片时,如果用户上传的是CMYK图片,那么在网站上将是无法显示的,通常的现象是出现一个红叉.下面使用将Ima ...

  9. 将python图片转为二进制文本的实例

    https://www.jb51.net/article/155342.htm 写在最前面: 我在研究机器学习的过程中,给的数据集是手写数字图片被处理后的由0,1表达的txt文件,今天写一写关于图片转 ...

随机推荐

  1. textfield reload issue and other things reload problem.===================================

    https://github.com/flutter/flutter/issues/18828 https://blog.csdn.net/u011272795/article/details/830 ...

  2. html5 浏览文件

    var fileInput = document.getElementById('test-image-file'), info = document.getElementById('test-fil ...

  3. Python模块 2

    collections模块 在内置数据类型(dict.list.set.tuple)的基础上,collections模块还提供了几个额外的数据类型: 1.namedtuple: 生成可以使用名字来访问 ...

  4. Spring Boot 监控利器 —— Actutor

    参考 CSDN-学习Spring Boot:(二十七)Spring Boot 2.0 中使用 Actuator 使用Actuator监控Spring Boot应用 程序猿DD-Spring Boot ...

  5. Python汉诺塔

    import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.it ...

  6. (js) 字符串和数组的常用方法

    JS中字符串和数组的常用方法 JS中字符串和数组的常用方法 js中字符串常用方法 查找字符串 根据索引值查找字符串的值 根据字符值查找索引值 截取字符串的方法 字符串替换 字符串的遍历查找 字符串转化 ...

  7. 【搬运工】修改mysql数据库的时区

    转载:https://blog.csdn.net/huangyuehong914/article/details/81742039 --------------------- ------------ ...

  8. 渐变UI

    1.h #import <UIKit/UIKit.h> @interface UIView (Gradient) /* The array of CGColorRef objects de ...

  9. lua 5.3.5 安装/初体验

    安装 官网http://www.lua.org/start.html 参考  https://blog.csdn.net/qq_23954569/article/details/70879672 cd ...

  10. 算法笔记--次小生成树 && 次短路 && k 短路

    1.次小生成树 非严格次小生成树:边权和小于等于最小生成树的边权和 严格次小生成树:    边权和小于最小生成树的边权和 算法:先建好最小生成树,然后对于每条不在最小生成树上的边(u,v,w)如果我们 ...