I’m trying to take a screenshot in puppeteer which i don’t save on the disk
let bytes = await page.screenshot({type: 'png'});
This gives me the encoded bytes which i then have to decode with a library like fast-png
So i can process the individual pixels to do things like screenshot testing.
The problem is that there is a big waste of time, since
puppeteer
is encoding the image in pngfast-png
is decoding it
i’m looking to directly extract the raw data from puppetteer (array of RGBA channels).
I was considering something like HTMLCanvasElement: toBlob
to be executed within the puppetteer context but the content i want to turn into a screenshot is classic html (non canvas) and this is a requirement that can’t change.
Thanks in advance if you have any suggestions.