Ruby SDK
The official Pictify SDK for Ruby provides an idiomatic Ruby interface for the Pictify API — generate images, PDFs, and GIFs from raw HTML, live URLs, and reusable templates.Installation
Add to your Gemfile:Quick Start
Configuration
The client is constructed with a keywordapi_key. Every request is sent with an Authorization: Bearer <API_KEY> header.
Rendering Images
From HTML — POST /image
Returns an ImageResult with url, id, and created_at.
/image endpoint accepts a single html field, so any css you pass is injected into a <style> tag prepended to the HTML.
From a live URL (screenshot) — POST /image
Rendering Templates
Single render — POST /templates/:uid/render
Returns a RenderResult results array (one item per rendered layout). result.url is a convenience accessor for the first result’s URL.
render(..., layout: "square").
Multiple layout variants — POST /templates/:uid/render
Templates can have multiple layout variants (e.g. landscape, square, story) created via AI Resize in the Pictify editor. Render several in one call (max 20); layouts that fail land in errors.
Rendering GIFs — POST /gif
Provide exactly one source: html, url, or template_id (+ optional variables). The source must contain motion (CSS animation, etc.). The { gif: {...} } envelope is flattened to a GifRenderResult.
Static content produces no frames and returns a render error (HTTP 422).
Batch Rendering (async) — POST /templates/:uid/batch-render
Batch rendering is asynchronous. Submitting returns a batch_id immediately (HTTP 202); poll get_batch_results to track progress.
Template Management
Error Handling
Only 5xx responses and network failures are retried (with exponential backoff); 4xx responses (including 429) are never retried.