Skip to content

Instantly share code, notes, and snippets.

Created Jan 22, 2018
What would you like to do?
const puppeteer = require('puppeteer');
const getColors = require('get-image-colors');
(async() => {
try {
// Initialize browser and page
const browser = await puppeteer.launch({args: ['--no-sandbox']});
const page = await browser.newPage();
// Open required page and set viewport to process desktop view of website
await page.goto(url, {waitUntil: 'load'});
// Taking full page screenshot without background color
const fullpageSS = await page.screenshot({
fullPage: true,
omitBackground: true,
type: 'jpeg',
quality: 100
// Extracting color
const colors = await getColors(fullPageSS, 'image/jpeg');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment