zinserjan / wdio-screenshot

A WebdriverIO plugin. Additional commands for taking screenshots with WebdriverIO.
MIT License
109 stars 43 forks source link

Performance improvements #68

Open zinserjan opened 7 years ago

zinserjan commented 7 years ago

There are some things that we can improve to get more screens in time. The goal is to reduce browser idle times as much as possible as the browser is the bottleneck and should theoretically never idle.

There are some optimizations that are safe to do (without breaking browser screenshots):

And some others need further researches or additional/manual tests to avoid errors:

lovell commented 7 years ago

Hello, I've just started investigating use of this rather handy module and spotted the following comment:

"sharp is limited to 16383px in width or height so this isn't a real alternative"

Did you see the limitInputPixels option? The following should be suitable for resizing large screenshots:

const png = await sharp(input)
  .limitInputPixels(false)
  .resize(width, height)
  .png({ adaptiveFiltering: false })
  .toBuffer();
zinserjan commented 7 years ago

Ah OK, didn't know that. Just saw some issues about this limit and the docs are also mentioning this limit.

But would be really cool if this works.

lovell commented 7 years ago

Ah, that is a most excellent point about the ambiguity of the docs, thank you. I'll attempt to make things clearer these are modifiable defaults.

EDIT: There are currently output limits, soon to be made more relevant to the specific output format - see https://github.com/lovell/sharp/issues/176

albertogasparin commented 7 years ago

FYI sharp v0.18+ now has a per-format limit, so for PNG it should be 32bit