How to Optimize Screenshot Performance
Screenshot Scout’s default screenshot options optimize for render quality rather than performance, which may not be the optimal choice for your specific use case.
Additionally, there are multiple screenshot options that, when used, may negatively affect rendering speed.
If your use case requires maximum rendering speed, and you're fine with an occasional decrease in the render quality of some screenshots, consider the optimization steps outlined below.
Switch the wait_until screenshot option
The wait_until param is responsible for determining when we decide the page has fully loaded before proceeding to capture the screenshot.
By default, wait_until is set to networkidle2, which means that we wait until there are no more than 2 active network connections for at least 500 ms. This ensures that most lazy-loaded assets are fully loaded before taking the screenshot, but at the same time may decrease rendering speed. In the case of some heavy pages, this decrease could be significant.
If you are fine with occasional screenshots not having some parts of the page fully loaded, consider setting wait_until to load.
Request URL example (unencoded for readability):
https://api.screenshotscout.com/v1/capture?access_key=YOUR_ACCESS_KEY&url=https://example.com/&wait_until=loadThis is the most significant performance optimization step you can take.
Disable the blocking of cookie banners, ads, and chat widgets
By default, we don’t block cookie banners, ads, or chat widgets when you use our web screenshot API. However, if you use these screenshot options explicitly, note that doing so may significantly decrease performance.
If your use case allows it, consider not using any of these options, or even explicitly setting them to false just in case we ever decide to change the default value in our screenshot API.
Request URL example (unencoded for readability):
https://api.screenshotscout.com/v1/capture?access_key=YOUR_ACCESS_KEY&url=https://example.com/&block_cookie_banners=false&block_ads=false&block_chat_widgets=falseFull page screenshots
When capturing full page screenshots, in addition to the performance optimization steps above, there are additional optimization steps that are relevant specifically to full page screenshots.
Disable full page scrolling
Whenever you capture a full page screenshot, we scroll the page from top to bottom to make sure all lazy-loaded assets are loaded before proceeding to capture the screenshot. This improves screenshot quality, but could significantly decrease performance.
If you’re fine with some lazy-loaded assets occasionally not being visible in your full page screenshots, consider setting full_page_pre_scroll to false (the default value is true).
Request URL example (unencoded for readability):
https://api.screenshotscout.com/v1/capture?access_key=YOUR_ACCESS_KEY&url=https://example.com/&full_page=true&full_page_pre_scroll=falseTune full page scrolling
If you don’t want to turn off full page scrolling altogether, consider tweaking the full_page_pre_scroll_step_delay screenshot option instead.
The scrolling is done in steps, with a small delay between steps. The full_page_pre_scroll_step_delay screenshot option sets that delay. Consider setting it to the lowest allowed value and see if it works for you. If not, adjust it.
Request URL example (unencoded for readability):
https://api.screenshotscout.com/v1/capture?access_key=YOUR_ACCESS_KEY&url=https://example.com/&full_page=true&full_page_pre_scroll_step_delay=50Limit the maximum height of the screenshot
Some pages you capture can be very tall, and some may even have infinite scroll.
If you don’t need to capture the entire scrollable page, and you’re fine with limiting the screenshot’s height to the first N pixels, consider using the full_page_max_height screenshot option.
Request URL example (unencoded for readability):
https://api.screenshotscout.com/v1/capture?access_key=YOUR_ACCESS_KEY&url=https://example.com/&full_page=true&full_page_max_height=20000This optimization step could significantly improve the performance of full page screenshots.