DEV Community

Пан Кіт
Пан Кіт

Posted on

OG Image generator based on SVG template

I like the idea of generating OpenGraph images based on some template. SVG structure looks customizable to me, so I tried to use .svg as an OG image and failed. OpenGrapgh does not support this format.

I have Rails app deployed to Heroku. I found a great idea of how to automate OG image creation here.

What we have to do:

  • Create an SVG template (use ERB to support variables);
  • Add mini_magic or similar lib for SVG to JPG conversion;
  • Create a rake task for generating JPG from SVG;
  • Add rake task to Heroku scheduler;

Created rake task will generate and attach JPG to model (will be uploaded to AWS); Rake task should find records without attached OG image. Sometimes you need to regenerate OG image, so it will be nice to have record-marking functionality.

This flow allows us to have an SVG template for the OG image, and also will separate CPU consumption (scheduler will use separate Dyno instance).

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read more →

Top comments (0)

Image of Docusign

🛠️ Bring your solution into Docusign. Reach over 1.6M customers.

Docusign is now extensible. Overcome challenges with disconnected products and inaccessible data by bringing your solutions into Docusign and publishing to 1.6M customers in the App Center.

Learn more