Introduction
In this tutorial, we'll walk you through creating a quote image generator for Instagram using Node.js and the Pictify API. This tool will allow you to automatically generate visually appealing quote images, perfect for engaging your Instagram audience and maintaining a consistent aesthetic on your profile.
Why build a quote image generator?
- Engagement: Quote posts often receive high engagement on Instagram.
- Consistency: Maintain a cohesive visual style across your quote posts.
- Time-saving: Automate the process of creating quote images.
- Customization: Easily adapt quotes to fit your brand's style.
Prerequisites
Before we begin, ensure you have:
- Node.js installed on your machine
- A Pictify API key (sign up at pictify.io)
- A unsplash API key (sign up at unsplash.com)
- Basic knowledge of JavaScript and Node.js
Step 1: Project Setup
Create a new directory for your project and initialize it:
Install the required packages:
Create a new file quoteGenerator.js and add the following boilerplate:
Step 2: Create the Image Template
Create a new file quoteTemplate.ejs with the following content:
Step 3: Generate Quote Content
Add a function to fetch a random quote. For this example, we'll use the Quotable API:
Step 4: Generate the Quote Image
Add a function to generate the quote image using Pictify API:
Step 5: Put It All Together
Add a main function to run the quote image generator:
Running the Generator
To run the quote image generator, execute:
Example output:

This will output a URL to your generated quote image, which you can then download or use in your Instagram posts.
Step 6: Adding Multiple Visual Themes
A single static design gets stale fast if you're posting daily. Instead of one quoteTemplate.ejs, maintain a small set of templates and pick one per quote so your feed doesn't look like the same card recolored.
Create three more templates alongside the original:
quoteTemplateMinimal.ejs: plain background color, no photo, large centered typequoteTemplateBold.ejs: solid brand color background, oversized quote text, no author photo overlayquoteTemplateGradient.ejs: CSS gradient background instead of an Unsplash photo, useful when you want zero external image dependency
Each one takes the same quoteText / quoteAuthor variables as the original; only the CSS and background source change. A gradient variant, for example, drops the backgroundImage param entirely:
Now map template names to files and pick one, either at random or on a rule (e.g. rotate by day of week so Mondays always look the same way):
This replaces the generateQuoteImage function from Step 4: same signature, but now template-aware. Everything downstream (Step 5's main()) keeps working unchanged, since templateName defaults to a random pick when you don't pass one.
Step 7: Batch-Generating a Week's Worth of Quotes
Once you're managing a content calendar rather than posting one-off, generating images one at a time in a loop each morning gets tedious. Generate a week's batch in a single run instead.
This runs sequentially with await inside the loop rather than firing all seven requests via Promise.all; both the Quotable API and Unsplash's free tier rate-limit aggressively, and a sequential loop is easier to reason about when one request in the middle fails. If you're generating from your own quote list instead of a random API, Promise.all over a fixed array is safe and considerably faster:
The output JSON (quote-batch.json) is the handoff point to whatever you use for scheduling: each entry has a ready-to-use image URL plus the quote metadata, indexed by day.
Step 8: Auto-Posting to Instagram
Generating the images is half the job; the other half is getting them onto your feed without opening Instagram seven times a week. Three practical options, roughly in order of setup effort:
Scheduling tools (Buffer, Later). Both accept an image URL via their API and let you queue a post for a specific time. Since generateBatch() above already returns a plain image URL per quote, wiring it into Buffer's API is a short loop:
Meta's Graph API directly. More setup (a Meta developer app, an Instagram Business account, a long-lived access token) but no third-party dependency. The flow is a two-step publish: create a media container from the image URL, then publish that container.
A cron job that just calls generateBatch() and stops there. If you'd rather review images before they go live, the simplest reliable pattern is: cron generates the week's batch into quote-batch.json every Sunday night, you glance at it Monday morning, and post manually. Automation doesn't have to mean zero human review; for a brand account, it often shouldn't.
Conclusion
You've now created a powerful tool for generating Instagram quote images using Node.js and the Pictify API, one that supports multiple visual themes, can batch-generate a week of content in one run, and has a clear path to scheduled auto-posting. This generator can be further customized to fit your brand's style by adjusting the EJS templates, using specific fonts, or integrating with your own quote database.
To extend this project further, consider:
- Pulling quotes from your own curated database instead of the random Quotable API, so every quote is on-brand
- Adding a review step (Slack notification, simple web UI) between batch generation and scheduling
- A/B testing which template style gets the most engagement, then weighting
pickTemplate()toward the winner
Happy quote posting!


