Optimize for speed when rendering screenshots in Puppeteer and Chrome DevTools Protocol

Published on Dmytro Krasun 1 min read
Let's talk about the optimizeForSpeed parameter introduced in Chrome DevTools Protocol which will soon be supported by Puppeteer or even supported now at the time when you are reading the post.

The optimizeForSpeed option is introduced in an update for Chromium, allows to use of faster encoding for images, and might increase the performance of taking screenshots by a lot.

Internally, the browser will use faster encoding for PNG, JPEG and WebP formats by restricting compression to zlib q1, which is rle encoding.

Try the option yourself to see if it improves performance and doesn’t change the quality of your screenshots.

By the way, there is a few related articles you might be interested in:

  1. Capture beyond viewport in Puppeteer and Chrome DevTools Protocol.
  2. Take a screenshot “from the surface” in Puppeteer and Chrome DevTools Protocol.
  3. A complete guide on how to take full page screenshots with Puppeteer, Playwright or Selenium.