Skip to content

LiquidImage

Open Graph image with Tailwind

A 1200×630 social image in Liquid with Tailwind classes, compiled at render time. Liquid passes options as keyword arguments (| image: width: 72), and an identical request with a live key within 24 hours is answered with the earlier file at zero units.

Free plan, no card. You get your own copy in the editor, published and ready for the API.

Rendered result

Rendered result: Open Graph image with Tailwind
PNG · 356 KB ↓ download

What this example shows

  • The settings fix the canvas: image with 1200×630 pixels, PNG and a device scale factor of 1, which is what social networks expect.
  • tailwind: true compiles the classes the markup uses at render time; there is no stylesheet to maintain.
  • truncate: 70 keeps a long headline inside the card, default: "Blog" fills a missing category, and image crops the avatar with fit: "cover".
  • access: "public" returns a CDN URL without a signature, which fits <meta property="og:image"> for as long as the file is kept; the retention of your plan decides how long that is.
  • With a live key, a request identical to one of the last 24 hours is answered with the earlier image and costs no units, so a second deploy on the same day renders nothing again. Renders with a test key are never deduplicated.

Helpers used

More on this use case: Open Graph image API →

Template folder

templates/og-image/template.htmlLiquid
<div class="flex h-[630px] w-[1200px] flex-col justify-between bg-gradient-to-br from-indigo-950 via-indigo-800 to-sky-600 p-20 text-white">
  <p class="text-2xl font-medium uppercase tracking-widest text-sky-200">
    {{ post.category | default: "Blog" }}
  </p>
  <h1 class="text-7xl font-bold leading-tight">{{ post.title | truncate: 70 }}</h1>
  <div class="flex items-center gap-6 text-2xl">
    {{ post.author.avatar | image: width: 72, height: 72, fit: "cover", alt: post.author.name, class: "rounded-full bg-white p-2" }}
    <span>{{ post.author.name }} · {{ post.published | date: "d MMM yyyy" }} · {{ post.minutes }} min read</span>
  </div>
</div>
templates/og-image/settings.jsonJSON
{
  "image": {
    "width": 1200,
    "height": 630,
    "deviceScaleFactor": 1,
    "format": "png"
  },
  "tailwind": true,
  "locale": "en-GB"
}
templates/og-image/data/default.jsonJSON
{
  "post": {
    "category": "Engineering",
    "title": "Templates belong in Git: reviewing invoice layouts in pull requests",
    "published": "2026-09-10",
    "minutes": 6,
    "author": {
      "name": "Formfeed",
      "avatar": "https://formfeed.dev/favicon.svg"
    }
  }
}

Render it through the API

Save the sample data as data.json and send it with the template’s name. Each language uses its SDK; curl sends the same JSON to the REST API, as any other language can. Renders with a key that starts with ff_test_ are not metered; on the Free plan they carry a small watermark.

render.shShell
jq '{template: "og-image", data: ., output: "png", access: "public"}' data.json \
  | curl https://api-eu.formfeed.dev/v1/renders \
      -H "Authorization: Bearer ff_test_..." \
      -H "Content-Type: application/json" \
      --data-binary @-
render.tsTypeScript
import { Formfeed } from '@formfeed/sdk';
import data from './data.json' with { type: 'json' };

const formfeed = new Formfeed({ apiKey: process.env.FORMFEED_API_KEY! });

const render = await formfeed.renders.create({
  template: 'og-image',
  data,
  output: 'png',
  access: 'public',
});
console.log(render.status, render.download_url);
render.pyPython
import json
import os

from formfeed import Formfeed

formfeed = Formfeed(api_key=os.environ["FORMFEED_API_KEY"])

with open("data.json", encoding="utf-8") as file:
    data = json.load(file)

render = formfeed.renders.create(
    template="og-image",
    data=data,
    output="png",
    access="public",
)
print(render.status, render.download_url)
render.phpPHP
<?php
require __DIR__ . '/vendor/autoload.php';

$formfeed = new Formfeed\Client(apiKey: getenv('FORMFEED_API_KEY'));

$render = $formfeed->renders->create([
    'template' => 'og-image',
    'data' => json_decode(file_get_contents('data.json'), true),
    'output' => 'png',
    'access' => 'public',
]);
echo $render->status, ' ', $render->downloadUrl, PHP_EOL;
main.goGo
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"
	"os"

	formfeed "github.com/formfeed-dev/formfeed-go"
)

func main() {
	client := formfeed.NewClient(os.Getenv("FORMFEED_API_KEY"))

	contents, err := os.ReadFile("data.json")
	if err != nil {
		log.Fatal(err)
	}
	var data map[string]any
	if err := json.Unmarshal(contents, &data); err != nil {
		log.Fatal(err)
	}

	render, err := client.Renders.Create(context.Background(), formfeed.RenderRequest{
		Template: "og-image",
		Data:     data,
		Output:   "png",
		Access:   "public",
	})
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(render.Status, render.DownloadURL)
}
Program.csC#
using System.Text.Json;
using Formfeed;

using var formfeed = new FormfeedClient(Environment.GetEnvironmentVariable("FORMFEED_API_KEY"));

var render = await formfeed.Renders.CreateAsync(new RenderRequest
{
    Template = "og-image",
    Data = JsonSerializer.Deserialize<Dictionary<string, object?>>(File.ReadAllText("data.json")),
    Output = "png",
    Access = "public",
});
Console.WriteLine($"{render.Status} {render.DownloadUrl}");
Render.javaJava
import com.fasterxml.jackson.databind.ObjectMapper;
import dev.formfeed.Formfeed;
import dev.formfeed.RenderRequest;
import java.io.File;

public class Render {
  public static void main(String[] args) throws Exception {
    var formfeed = Formfeed.builder().apiKey(System.getenv("FORMFEED_API_KEY")).build();
    var data = new ObjectMapper().readTree(new File("data.json"));

    var request = RenderRequest.template("og-image")
        .data(data)
        .output("png")
        .set("access", "public");
    var render = formfeed.renders().create(request);
    System.out.println(render.getStatus() + " " + render.getDownloadUrl());
  }
}
render.rbRuby
require "json"
require "formfeed"

formfeed = Formfeed::Client.new(api_key: ENV.fetch("FORMFEED_API_KEY"))

render = formfeed.renders.create(
  template: "og-image",
  data: JSON.parse(File.read("data.json")),
  output: "png",
  access: "public"
)
puts "#{render.status} #{render.download_url}"

Start rendering today

The free plan includes 100 units a month and free test renders. Change plans when you need more.