Link Search Menu Expand Document

URL to Image

The high resolution screenshot API you’ve been searching for.

Get an API Key


Table of contents


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' 
             --data-urlencode 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.

Name Type Description
google_fonts String Google fonts to be loaded. Example: Roboto. Multiple fonts can be loaded like this: Roboto|Open Sans
selector String 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
ms_delay Integer The number of milliseconds the API should delay before generating the image. This is useful when waiting for JavaScript. We recommend starting with 500. Large values slow down the initial render time. Learn more.
device_scale Double Controls the image resolution by adjusting the pixel ratio. Minimum: 1, Maximum: 3. Higher values increase image quality and file size. For example, 2 will double the resolution. Learn more.
render_when_ready Boolean Set to true to control when the image is generated. Call ScreenshotReady() from JavaScript to generate the image. Learn more.
full_screen Boolean When set to true, the API will generate an image of the entire height of the page.
viewport_width Integer Set the width of Chrome’s viewport. This will disable automatic cropping. Both height and width parameters must be set if using either.
viewport_height Integer Set the height of Chrome’s viewport. This will disable automatic cropping. Both height and width parameters must be set if using either.

Screenshot examples

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

Screenshot of stripe.com auto generated with the API


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.


Pages requiring login or sign-in

Our API does not support pages that require login. The URL must be publicly accessible for us to generate an image of it. Supporting login is a common request, but we have chosen not to support it due to the risk of storing and transmitting credentials.

Some sites have the option of creating an “embed” of a page. This is the best option if it’s available to you. You can then use the embed’s HTML to generate a screenshot without login.


Need help getting started?

We’d be happy to walk you through getting started. Send us an email: support@htmlcsstoimage.com. We’re experts at generating images and will help you get going using the API.


Back to top

Built with extensive integration tests and serious care for developer happiness.
© 2018-2024 Code Happy, LLC.

Page last modified: Dec 26 2024 at 02:39 PM.

Edit this page on GitHub.