Tools to Capture and Convert the Web

How to create Captures even faster!

Faster Captures

It is difficult to say how long it will take to create a capture, as not all of the time is actually used rendering the capture. For instance some time is also required to load the target website or HTML. To speed up screenshot rendering first check that you are not using a delay when generating screenshots.

Not only will specifying a delay increase how long it takes to create the capture it can also effect capture priority, in the unlikely event of a queue. Fortunately there are ways around this.

Next check, what retrieval method you are using to be notified that your capture is complete? The synchronous method, SaveTo is much slower than the asynchronous method Save. As the SaveTo method has to poll the GrabzIt every three seconds to determine if a screenshot is complete while the asynchronous method will call your callback URL as soon as the screenshot is ready.

Other techniques that can improve capture time include:

  1. Blocking adverts, this reduces the time it takes to capture some web pages by 50%.
  2. If you are trying to capture a website that is hosted in a particular part of the world specify a country near to that location.
  3. If you are trying to capture websites hosted all around the use GrabzIt's exclusive Geo-targeting feature.
  4. If you are converting HTML into image, PDF or DOCX documents try embedding any referenced images (as Data URIs), scripts and CSS files directly into the HTML. This will reduce the number of resources that have to be loaded before the HTML can be converted. Also if you can remove any redundant HTML that does not need to appear in the output, such as hidden HTML elements and comments. As this will reduce the time it takes to convert the HTML.
  5. If you are creating HD captures, ensure you are not setting the image width and height parameters to anything other than -1. As this would scale the HD image down again it would be both counterproductive and time consuming.
  6. Using local or global proxies adds extra hops into the network transmission. Only use proxies if you have to.
  7. Avoid exporting a capture to third-party storage, such as FTP, Dropbox or S3. As this adds an extra delay before the capture is returned to you.

Another issue can be the time it takes to download a screenshot. First check the size of the captures you are producing, if they are large files you could try to improve the download time by doing one or more of the following:

  1. Reduce the size of the image, by altering the output width and height.
  2. Reduce the quality of the capture.
  3. Use a more compressed image format such as PNG.

Finally, if you control the page you are taking a screenshot of try to optimise it. This will take a little testing on your part, but could save you several seconds. Somethings to try includes compressing images, scripts and CSS or even embedding resources directly into the HTML of web page. This avoids separate requests when generating the web capture.

JavaScript API Specific Improvements

While many of the optimisations above can be implemented when using the JavaScript API, as JavaScript runs in the browser rather than the on server side there are a series of potential optimisations and problems unique to it.

Consider using the preconnect technique. This will ensure that the DNS resolution and any required SSL handshake is complete before the first call to GrabzIt's API. To do this add the following code to the HEAD tag of the HTML page where GrabzIt is being used.

<link rel="preconnect" href="https://api.grabz.it" crossorigin>
<link rel="preconnect" href="https://grabz.it" crossorigin>

Note that if your website is HTTP only, you will need to alter the above URL's to use http and not https.

If you are using JavaScript's DataURI method this will add an extra overhead compared to the server side API's as JavaScript has to read a image as bytes and convert it to a data URI.