Update utils.mjs
This commit is contained in:
@@ -18,7 +18,7 @@
|
||||
import PNG from "png-js"
|
||||
|
||||
//Exports
|
||||
export {fs, os, paths, url, util, processes, axios, git, opengraph, rss}
|
||||
export {fs, os, paths, url, util, processes, axios, git, opengraph, jimp, rss}
|
||||
|
||||
/**Returns module __dirname */
|
||||
export function __module(module) {
|
||||
@@ -274,11 +274,11 @@
|
||||
}
|
||||
|
||||
/**Create record from puppeteer browser */
|
||||
export async function record({page, width, height, frames, scale = 1, quality = 80, x = 0, y = 0, delay = 150}) {
|
||||
export async function record({page, width, height, frames, scale = 1, quality = 80, x = 0, y = 0, delay = 150, background = yes}) {
|
||||
//Register images frames
|
||||
const images = []
|
||||
for (let i = 0; i < frames; i++) {
|
||||
images.push(await page.screenshot({type:"png", clip:{width, height, x, y}}))
|
||||
images.push(await page.screenshot({type:"png", clip:{width, height, x, y}, omitBackground:background}))
|
||||
await wait(delay/1000)
|
||||
if (i%10 === 0)
|
||||
console.debug(`metrics/record > processed ${i}/${frames} frames`)
|
||||
|
||||
Reference in New Issue
Block a user