textintoimage

n8n node to generate HDR-quality motivation images from text — perfect for Instagram posts

Package Information

Released: 4 mo ago
Downloads: 6 weekly / 320 monthly
Latest Version: 1.0.1
Author: ngquocvu

Documentation

n8n-nodes-text-to-image

Generate beautiful, HDR-quality motivation images from text — directly inside your n8n workflows. Perfect for automated Instagram posts.

Node Icon


Features

  • 6 built-in templates — dark minimal, light elegant, vibrant purple, golden hour, arctic clean, midnight blue
  • Full custom mode — control every visual parameter
  • Multi-line text — use \n in your text input
  • Batch generation — generate many images at once from a JSON array
  • HDR output — renders internally at 2× resolution for crisp Retina/HDR screens
  • Effects — vignette, film grain, gradient backgrounds
  • Output formats — PNG (lossless) or JPEG (adjustable quality)
  • Bundled fonts — Inter, Playfair Display, Oswald, Montserrat (no internet required)

Prerequisites

Important: node-canvas requires native system libraries (Cairo, Pango, libjpeg). This node works on self-hosted n8n only. See Docker section below.

macOS (local dev)

brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman

Ubuntu/Debian

sudo apt-get install -y libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

Docker

See Dockerfile.example in this repo for a ready-to-use setup.


Installation

Option 1: Local ~/.n8n/custom/ (Self-hosted)

# 1. Clone and build
git clone <this-repo>
cd n8n-nodes-text-to-image
npm install
npm run build

# 2. Download bundled fonts (see Fonts section below)
npm run download-fonts

# 3. Copy to n8n custom nodes directory
mkdir -p ~/.n8n/custom/node_modules/n8n-nodes-text-to-image
cp -r dist package.json ~/.n8n/custom/node_modules/n8n-nodes-text-to-image/

# 4. Restart n8n
n8n start

Option 2: Docker (Local)

See Dockerfile.example. Build it with:

docker build -f Dockerfile.example -t n8n-custom .
docker run -it --rm -p 5678:5678 n8n-custom

Option 3: Heroku ☁️

See HEROKU.md for the complete guide including:

  • Option A — Heroku Container Registry (Docker) ✅ Recommended
  • Option B — Heroku Buildpacks + Aptfile

Quick start:

heroku create your-n8n-app
heroku container:login
heroku container:push web -a your-n8n-app --dockerfile Dockerfile.heroku
heroku container:release web -a your-n8n-app

Fonts

This node bundles the following fonts (placed in nodes/TextToImage/fonts/):

Font Variants Style
Inter Regular, Bold Modern, clean
Playfair Display Regular, Bold, Italic Elegant, serif
Oswald Regular, Bold Condensed, strong
Montserrat Regular, Bold Geometric, versatile

Downloading fonts:

npm run download-fonts

This script fetches .ttf files from Google Fonts and places them in the correct directory.


Usage

1. Single Image

  1. Add the Text to Image node to your workflow
  2. Pick a Template (or select Custom)
  3. Type your Text (use \n for line breaks)
  4. Adjust canvas size (default: 1080×1080 for Instagram square)
  5. Choose output format (PNG or JPEG)
  6. Connect the output to a Write Binary File, Google Drive, or HTTP Request node

2. Batch / Multiple Images

Enable Generate Multiple Images, then set the Text field to a JSON array:

["You are enough.", "Keep going.\nOne step at a time.", "Dream big. Start small."]

This produces one output item per string — each with its own binary image. Chain with a Loop Over Items node to post each to Instagram sequentially.


Templates

Template Background Font Best For
⚫ Dark Minimal #0D0D0D solid Inter Bold 72px white Clean, modern
🤍 Light Elegant #FAF7F0 solid Playfair Display Italic 68px Soft, luxury
💜 Vibrant Purple #1A0533 → #6B21A8 gradient Oswald Bold 80px white Bold, energetic
✨ Golden Hour #2C1A0E warm gradient Playfair Display Bold 70px gold Warm, inspirational
🩵 Arctic Clean #F0F4F8 solid Inter Regular 64px dark Professional, minimal
🌑 Midnight Blue #0F172A gradient Montserrat Bold 70px light Night, sophisticated

Output

Each item in the output contains:

JSON fields:

Field Description
fileName e.g. image_1.png
width Canvas width in px
height Canvas height in px
template Template name used
text Text that was rendered
outputFormat png or jpeg
index 0-based index (batch mode)

Binary field (default name: image):
The generated image binary — connect directly to any n8n node that accepts binary data.


Example Workflow

[Manual Trigger]
      ↓
[Text to Image] — Template: Golden Hour, Text: "Be the change."
      ↓
[Write Binary File] — path: /output/motivation.png

Or for Instagram automation:

[Schedule Trigger]
      ↓
[Text to Image] — Batch mode, 7 quotes for the week
      ↓
[Loop Over Items]
      ↓
[HTTP Request] — POST to Instagram Graph API

License

MIT

Discussion