Tools to Capture and Convert the Web

How to create High Definition Screenshots?

Occasionally you may want to create high definition (HD) or retina screenshots. High Definition screenshots are slower and become even slower with larger dimensions for this reason it is recommended not to create too large an image. As such you will probably also need to specify a delay to give the screenshot chance to render.

The following code shows how to make a high definition screenshot in each language, by setting the HD parameter to true. This creates a high resolution image by doubling the image width and height, increasing the resolution of a standard screenshot by four times. However it would be counter productive to set a width and height to anything but -1 as this would cause the image to be scaled down again!

GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.HD = true;
options.OutputWidth = -1;
options.OutputHeight = -1;
grabzIt.URLToImage("https://www.bbc.co.uk", options);
grabzIt.SaveTo("images/result.jpg");
GrabzItClient grabzIt = new GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
ImageOptions options = new ImageOptions();
options.setHd(true);
options.setWidth(-1);
options.setHeight(-1);
grabzIt.URLToImage("https://www.bbc.co.uk", options);
grabzIt.SaveTo("images/result.jpg");
<script src="https://cdn.jsdelivr.net/npm/@grabzit/js@3.3.6/grabzit.min.js"></script>
<script>
GrabzIt("Sign in to view your Application Key").ConvertURL("https://www.bbc.co.uk", 
{"hd":true,"width":-1,"height":-1}).Create();
</script>
var grabzit = require('grabzit');

var client = new grabzit("Sign in to view your Application Key", "Sign in to view your Application Secret");
var options = {"hd":true,"width":"-1","height":"-1"};
client.url_to_image("https://www.bbc.co.uk", options);
client.save_to("images/result.jpg", function (error, id){
    if (error != null){
        throw error;
    }
});
$grabzIt = GrabzItClient->new("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = GrabzItImageOptions->new();
$options->hd(1);
$options->width(-1);
$options->height(-1);
$grabzIt->URLToImage("https://www.bbc.co.uk", $options);
$grabzIt->SaveTo("images/result.jpg");
$grabzIt = new \GrabzIt\GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret");
$options = new \GrabzIt\GrabzItImageOptions();
$options->setHD(true);
$options->setWidth(-1);
$options->setHeight(-1);
$grabzIt->URLToImage("https://www.bbc.co.uk", $options);
$grabzIt->SaveTo($filepath);
grabzIt = GrabzItClient.GrabzItClient("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzItImageOptions.GrabzItImageOptions()
options.hd  = True
options.width = -1
options.height = -1
grabzIt.URLToImage("https://www.bbc.co.uk", options)
grabzIt.SaveTo("images/result.jpg")
grabzIt = GrabzIt::Client.new("Sign in to view your Application Key", "Sign in to view your Application Secret")
options = GrabzIt::ImageOptions.new()
options.hd = true
options.width = -1
options.height = -1
grabzItClient.url_to_image("https://www.bbc.co.uk", options)
grabzItClient.save_to("images/result.jpg")

On the left is an example of a standard screenshot and on the right is a high definition screenshot produced by the code above, both screenshots have the same height.


Setting the Image Resolution Precisely

High definition screenshots of different sizes can also be created by specifying a width larger than the browser width. GrabzIt then scales the browser to stop the image being stretched. However measurements taken when creating high definition screenshots in this way are inaccurate, which is why full-length screenshots are not always perfectly sized or scaled in this mode.

If you are having issues creating correctly scaled high definition images using this method, please try using a image width and height is x2, x3 or x4 of the original browser dimensions.

This mode will also not work properly when targeting elements. If you want to target elements it is recommended you set the HD parameter as shown above.