1. Products
  2.   Image
  3.   JavaScript
  4.   Capture-Website
 
  

Open Source JavaScript Library for Image Processing

JavaScript API for capturing screenshots of websites

What is Capture-Website?

Capture-Website is an open-source lightweight image processing library that enables JavaScript developers to capture screenshots of websites. Using the API, you can take screenshots of any website by using the URL of the site and the screenshots are saved on the output file path. You can set the width, height, type, and image quality of screenshots. Furthermore, you can also take screenshots based on specific device sizes.

Using the API, you can not only take screenshots of the visible portion but the complete site including the full scrollable page. By default, the API uses a white background for the screenshots. If you remove the background, the API will capture screenshots with transparency.

Previous Next

Getting Started with Capture-Website

The recommended way to install Capture-Website via NPM. Please use the following command to install it.

Install Capture-Website Thief via NPM

 npm install capture-website 

Capture Screenshots of Website via Free JavaScript API

The open-source Capture-Website library allows JavaScript developers to capture screenshots of websites programmatically. In order to capture screenshots of the site, the API provides captureWebsite.file() method. The method takes an input file name, output file path, and options for the screenshots. By using the following two lines of code, you can easily get take screenshots of the website.

Capture Website Screenshots

  1. Import capture Website Library
  2. Capture Screenshots of a site using captureWebsite.file(input, outputFilePath, options?). The method captures a screenshot of the given input and saves it to the given outputFilePath.
  3. You can also set options like height, width type, and width for the output file

Capture Screenshots of Website in JavaScript

import captureWebsite from 'capture-website';
    await captureWebsite.file('https://fileformat.com', 'screenshot.png');
                        
            

Capture Screenshots for Specific Device Size in JavaScript

The open-source Capture-Website library allows JavaScript developers to capture screenshot as it was taken on the specified device. In order to capture screenshots of the site, the API provides emulateDevice property. You can emulate an iPhone X size screenshot. By using the following two lines of code, you can easily emulate screenshots of the website.

Emulate Device for Screenshots

  1. Import capture Website Library
  2. Capture Screenshots of site using captureWebsite.file(input, outputFilePath, options?). The method captures a screenshot of the given input and saves it to the given outputFilePath.
  3. Emulate using emulateDevice property and set the value to 'iPhone X'

Emulate Screenshots of Website in JavaScript

import captureWebsite from 'capture-website';
    
    await captureWebsite.file('https://fileformat.com', 'screenshot.png', {
        emulateDevice: 'iPhone X'
    });
                        
            
 English