Stencil Documentation
  • General
  • API
    • Authentication
      • Account
    • Pagination
    • Status Code and Throttling
    • Endpoints
      • Projects
      • Templates
      • Images
      • Collections
      • PDFs
      • Airtable
    • Charts
  • Using Stencil
    • Template Editor (New)
    • Template Editor (Legacy)
      • Limited Markdown Supports
      • Anchoring Element
      • Using Custom Font
      • Circular Text Positioning
    • White Label for Business
      • Setting Up Your First Client
      • DNS Setup with Cloudflare
  • Guides
    • Airtable Integration
      • Basic
    • Integromat Integration
      • Connection
      • Instant Trigger
    • Zapier Integration
      • Authentication
      • Trigger - New Image
      • Action - Create Image
    • Secure Signed Image
      • Basic
    • Query String Integration
      • Basic
      • Cache
    • Forms Integration
    • Case Studies
      • Generate Instagram Post from WooCommerce
      • Generate Open Graph Image for WordPress
      • Generate Personalized SendGrid Email Campaigns
      • Sending Charts to Twitter
      • Generate Instagram Post from Shopify
      • Automating Webflow Open Graph Image
      • Generate certificate of accomplishment
      • Automate Candidate's Certificate Generation
  • LINKS
    • Back to Stencil
    • Got bug?
    • Need feature?
    • Blog
Powered by GitBook
On this page
  • Create image synchronously
  • Create image asynchronously
  • Modification object
  • Image Quality

Was this helpful?

  1. API
  2. Endpoints

Images

Generate image with POST request

Create image synchronously

POST https://api.usestencil.com/v1/images/sync

Create image synchronously and get the result in within the same request.

Request Body

Name
Type
Description

modifications

array

Array of modification objects

metadata

object

Extra metadata to be included together with the webhook

webhook_url

string

URL of the webhook to be called when the image is done processing

template

string

The ID of the template

transparent

boolean

Set image background transparency

png_multiplier

integer

jpeg_quality

float

{    "name": "Cake's name",    "recipe": "Cake's recipe name",    "cake": "Binary cake"}
{    "message": "Ain't no cake like that."}

Create image asynchronously

POST https://api.usestencil.com/v1/images

Create image asynchronously. Once image is done processing, the specified webhook is called with the generated image.

Request Body

Name
Type
Description

modifications

array

Array of modifications objects

metadta

object

Extra metadata to be included together with the webhook

webhook_url

string

URL of the webhook to be called when the image is done processing

template

string

The ID of the template

transparent

boolean

Set image background transparency

png_multiplier

integer

jpeg_quality

float

{
    // Response
}

Modification object

Modification object generally follows the following pattern,

  "modifications": [
    {
      "name": "text_1",
      "text": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do..."
    },
    {
      "name": "rating_3",
      "rating": 3.5
    }
  ]

name is a required property.

The name is the field unique identifier in the template editor

The rest of the properties depend on the type of object. If you need full list of supported properties, you can view them in them in API Console.

Image Quality

PNG

For PNG images, you can set png_multiplier to adjust the quality of generated images.

For example, if your template size is 800x800 then setting the png_multiplier to 2 will scale the image to 1600x1600 which creates a higher resolution image.

Please note that higher quality image will increase the image size and will also increase the image generation time.

JPEG

For JPEG images, you can set jpeg_quality to adjust the quality of generated images. JPEG is a lossy format, while it offers higher compression rate that could decrease the file size, it also degrades the image quality.

You can control this by setting jpeg_quality to a number between 0 and 1 with 1 being the highest quality.

Please note that higher quality image will increase the image size and will also increase the image generation time.

Default Settings

You can also set a default settings for all templates in your project. Go to your project's settings page and set the values accordingly.

You can always override these values in the API by following the instructions mentioned above.

PreviousTemplatesNextCollections

Last updated 3 years ago

Was this helpful?

Set the quality of PNG image. Must be greater or equal to 1. See section.

Set the quality of JPEG image. Must be between 0 and 1 with 1 being the highest quality. See section.

Set the quality of PNG image. Must be greater or equal to 1. See section.

Set the quality of JPEG image. Must be between 0 and 1 with 1 being the highest quality. See section.

Image Quality
Image Quality
Image Quality
Image Quality
Console shows all available modifications for each template