Capture screenshots of websites on command line or REST API.
$ snapkit https://google.com --emulate="iPad" | open -a Preview.app -f
Or, from inside your own Node.js program.
const snapkit = require('snapkit')
async () => {
let image = await snapkit('https://google.com')
}
/* snapkit has a child process that starts on import, close it */
async close => snapkit.close()
Accepts either HTML page content as as string or a URL to a remote site.
options <[Object]>
emulate <[string]> Device to emulate, list of available devices at snapkit.devicestransparency <[boolean]> Hides default white background and allows capturing screenshots with transparency. Defaults to false.userAgent <[string]>type <[string]> Specify screenshot type, can be either jpeg or png. Defaults to 'png'.quality <[number]> The quality of the image, between 0-100. Not applicable to png images.fullPage <[boolean]> When true, takes a screenshot of the full scrollable page. Defaults to false.viewport <[Object]>
width <[number]> page width in pixels.height <[number]> page height in pixels.deviceScaleFactor <[number]> Specify device scale factor (can be thought of as dpr). Defaults to 1.isMobile <[boolean]> Whether the meta viewport tag is taken into account. Defaults to false.hasTouch<[boolean]> Specifies if viewport supports touch events. Defaults to falseisLandscape <[boolean]> Specifies if viewport is in landscape mode. Defaults to false.clip <[Object]> An object which specifies clipping region of the page. Should have the following fields:
x <[number]> x-coordinate of top-left corner of clip areay <[number]> y-coordinate of top-left corner of clip areawidth <[number]> width of clipping areaheight <[number]> height of clipping areaArray of available device emulations.
Close the browser instance and child process.