Output HTML page into the image
Task: display html page by link to some pngimage.
Solution:
One of ways is use google-crome browser:
google-chrome --headless --screenshot --window-size=240,176 --default-background-color=0 https://scalan.com/...
Result filename: screenshot.png
Explanation of the command:
- run Chrome browser from the command line
--headlessruns browser without opening it and closes it after the command completes--screenshotwill capture a screenshot (result file calledscreenshot.pngin the folder where the command is run or use--screenshot='absolute\path\of\screenData.png'- works for me)--window-sizeset result image size (format is--window-size=width,height)--default-background-color=0for Chrome to use a transparent background, not the default white color
My real usage:
I use this way to display information on my Raspberry Pi device with e-ink display.
My bash script:
- prepare image from my page;
- display image by python script.
Call this script periodically (every minute) from cron job.
