How to save HTML to image
As I discussed in How to embed matplotlib figure in html, sometime the return from different third-party tools are HTML. In order to merge different analysis into one, I use image as a media.
How to covert html to image?
- Install wkhtmltopdf,
- Install python package, imgkit
sudo apt-get install wkhtmltopdf pip install imgkit
Then you can save HTML to image
import imgkit imgkit.from_url('http://google.com', 'out.jpg') imgkit.from_file('test.html', 'out.jpg')
Here is an example to show merged image of backtrader figure report and quantstats html report