Taking a screenshot of a webpage.
screenshot.py is a wrapper script that calls
convert to do the real job. The advantage of
screenshot.py is its very simple usage.
screenshot.py -full http://reddit.com full.jpg
Screenshot of the entire page (can be very high).
screenshot.py -window http://reddit.com window.jpg
Screenshot of the area that you see in the browser.
screenshot.py -thumb http://reddit.com thumb.jpg
Thumbnail of the area that you see in the browser.
--nojsextra option. Then use the script as explained above.
screenshot.py --nojs -thumb http://buggy-js.com thumb.jpg
Check out the beginning of the source code. You may want to change
screenshot.py relies on PhantomJS and the command
convert is part of the ImageMagick package. See http://phantomjs.org/build.html for more information on how to install PhantomJS. We also need the
rasterize.js script that comes with PhantomJS. You can find a copy of it in the
assets/ folder. I also put a customized version of the rendering script to the
assets/ folder called
Author / Links
- Laszlo Szathmary, alias Jabba Laci ([email protected]), 2015
- reddit discussion: http://redd.it/3cyka8
- appeared in ImportPython Weekly Newsletter - Issue No 39