Created
January 22, 2018 02:21
-
-
Save cemjotform/0d8d8b9916c25d25478585548bc93b9e to your computer and use it in GitHub Desktop.
This file contains 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