Open Source JavaScript Library for Image Processing
Capture screenshots of websites in various resolutions.
What is Pageres?
Pageres is a free and open-source API that allows JavaScript developers to take a screenshot of websites programmatically. The purpose of the API is to make sure that your website is responsive. It is lightweight and fast and can generate 100 screenshots from 10 different websites in just over a minute. It takes screenshots in various resolutions to make sure that the website is responsive. Furthermore, the API can also be used to render SVG images.
In order to take screenshots of the site, you need to pass the URL of the site. You can specify the size, width, height, date, and time for the output screenshot. Furthermore, you can specify an incremental name for the screenshots - so, when a file exists, it appends an incremental number.
Getting Started with Pageres
The recommended way to install Pageres via NPM. Please use the following command to install it.
Install Pageres via NPM
npm install pageres
Capture Screenshot of Website via Free JavaScript API
The open source Pageres library allows JavaScript developers to take screenshots of websites programmatically. In order to take screenshots of the website, the API provides Pageres() method. You can set delay, timeout, crop, CSS, and other options while taking screenshots. For the output file, you can set size, width, height, date, and time. By using the following code, you can take screenshots of your website.
Capture Screenshots in JavaScript
- Import Library
- Capture Screenshots
Capture Screenshots of website in JavaScript
const Pageres = require('pageres');
(async () => {
await new Pageres({delay: 2})
.src('https://products.fileformat.com', ['480x320', '1024x768', 'iphone 5s'], {crop: true})
.dest(__dirname)
.run();
console.log('Finished generating screenshots!');
})();
});