Created
January 22, 2018 02:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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