0CodeKit icon

0CodeKit

A toolbox of no-code utilities

Actions114

Image → HTML to Image

AI-generated

Overview

This node operation converts HTML content or a URL pointing to an HTML page into an image. It supports inputting either raw HTML code or a URL, along with customizable options for the image generation such as image type, full page capture, animation disabling, device emulation, and dark mode. This is useful for scenarios where you need to generate visual representations of web content, such as creating thumbnails, previews, or snapshots of web pages or HTML snippets.

Use Case Examples

  1. Generating a PNG image from a given HTML snippet for use in reports or presentations.
  2. Capturing a full-page screenshot of a webpage by providing its URL, useful for monitoring website changes or archiving.
  3. Creating mobile device emulated images of HTML content by specifying device type and dark mode settings.

Properties

Name Meaning
Code Variables Variables defined in the code editor that can be used within the HTML to image conversion process. Allows dynamic substitution of values in the HTML.
Type of Data Specifies whether the input is a URL or raw HTML code to convert to an image.
HTML The raw HTML code to convert to an image. Shown only if 'Type of Data' is set to HTML.
URL The URL of the HTML page to convert to an image. Shown only if 'Type of Data' is set to URL.
Options HTML to Image JSON object specifying options for the HTML to image conversion, such as image type (png, jpg), full page capture, disabling animations, device emulation, and dark mode.
File Name Filename to assign to the generated image file.
Get File as URL Boolean flag indicating whether to return the generated image as a URL instead of raw data.

Output

JSON

  • imageUrl - URL of the generated image if 'Get File as URL' is true.
  • imageData - Raw image data if 'Get File as URL' is false.

Dependencies

  • Requires an API key credential for the CodeKit API to perform the HTML to image conversion.

Troubleshooting

  • Ensure the HTML or URL input is valid and accessible; invalid HTML or unreachable URLs will cause errors.
  • Check that the options JSON is correctly formatted and contains valid keys and values for the HTML to image operation.
  • If the image is not returned as expected, verify the 'Get File as URL' setting and the node's output handling.
  • Common errors may include network issues, invalid API credentials, or unsupported HTML features in the conversion process.

Discussion