Skip to content

Latest commit

 

History

History
106 lines (77 loc) · 3.16 KB

url-to-image.md

File metadata and controls

106 lines (77 loc) · 3.16 KB
layout title permalink description parent nav_order
page
URL to Image
/getting-started/url-to-image/
Take a screenshot of any URL using the API. Screenshot generated in a real instance of Google Chrome.
Getting started
4

URL to Image

{: .no_toc } {: .fs-9 }

The high resolution screenshot API you've been searching for. {: .fs-6 .fw-300 }

Get an API Key{: .btn .fs-5 .mb-4 .mb-md-0 }


Table of contents {: .text-delta }

  • TOC {:toc}

Creating an image from a URL

With the API, you can automate taking a screenshot of any website.

Pass the url param to the hcti.io/v1/image endpoint, and we'll generate a screenshot for you. Here's an example using cURL.

curl -X POST https://hcti.io/v1/image -u 'UserID:APIKey' 
             -d url="https://google.com"

Don't write code? Don't worry, you can also do this with our Zapier integration.

Screenshot of google.com

Additional parameters

To customize your image further, you can take advantage of the following optional parameters.

Parameter
viewport_width Set the width of Chrome's viewport. Defaults to 1366.
viewport_height Set the height of Chrome's viewport. Defaults to 768.
device_scale This adjusts the pixel ratio for the device. Default: 1. Maximum 3.
ms_delay The number of milliseconds the API should delay before taking the screenshot. This is useful when waiting for JavaScript. If you need to use this, we recommend starting with a low number, such as 500. Increasing this value slows down the speed of your initial render.
selector A CSS selector for an element on the webpage. We'll crop the image to this specific element. For example: section#complete-toolkit.container-lg

Screenshot examples

A full screenshot of stripe.com. With device scale set to 2, for a super high resolution image.

Screenshot of stripe.com


Screenshot part of a page with Selector

You can set a selector to target a specific part of the page.

For example, on Stripe's homepage, there is an element with the CSS selector section#complete-toolkit.container-lg.

When passing that to the API, we crop to that element only.

Use a CSS selector to crop an image


CSS Selectors

To learn about CSS Selectors, we recommend this article. There are also Chrome extensions that detect them for you, we like using: Selector Gadget.


## Need help getting started?

We'd be happy to walk you through getting started. Send us an email: [email protected]. We're experts at generating images and will help you get going using the API.