python html转png
导读:安装包pip install html2image转换本地html文件from html2image import Html2Image hti = Html2Image( hti.screenshot(other_file='测试.ht...
安装包
pip install html2image转换本地html文件
from html2image import Html2Image
hti = Html2Image()
hti.screenshot(other_file='测试.html', save_as='测试.png')
转换url
from html2image import Html2Image
hti = Html2Image()
hti.screenshot(url='https://www.baidu.com/', save_as='baidu.png')
设置图片大小
from html2image import Html2Image
hti = Html2Image()
hti.screenshot(url='https://www.baidu.com/', save_as='baidu.png', size= (1000,1000))
更多参考
I wrote a Python package that lets you generate images from HTML/CSS strings or files and URLs
html2image
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: python html转png
本文地址: https://pptw.com/jishu/555.html