A CLI tool that renders text to a PNG image. Provide your text, pick a color, font, and size — the tool renders a PNG, opens it in your system image viewer for review, and then lets you save it, redraw with new options, or quit.
npm installTo use the text-to-png command globally from anywhere on your machine:
npm linkTo unlink later: npm unlink -g text-to-png-renderer
npm run cli -- --text "Your text here" [options]
# or, after npm link:
text-to-png --text "Your text here" [options]| Flag | Short | Description | Default |
|---|---|---|---|
--text |
-t |
Text to render (required) | — |
--color |
-c |
Text color — hex or CSS named color | black |
--size |
-s |
Font size in pixels (8–500) | 32 |
--font |
-f |
Font preset or path to a .ttf/.otf file |
sans |
| Preset | Typeface |
|---|---|
sans |
Roboto Regular |
bold |
Roboto Bold |
mono |
Roboto Mono Regular |
# Basic
npm run cli -- --text "Hello World"
# Custom color (named) and size
npm run cli -- --text "Launch Day" --color tomato --size 64
# Hex color and bold font
npm run cli -- --text "Big News" --color "#3b82f6" --size 48 --font bold
# Monospace font
npm run cli -- --text "console.log('hi')" --font mono --size 24
# Custom font file
npm run cli -- --text "Custom Font" --font ./path/to/MyFont.ttf --color purpleYou run the command with --text, --color, --size, --font
│
▼
Validate inputs
(color format, size range,
font preset or file path)
│
▼
Render PNG in memory
(auto-sized canvas, white
background, text centered)
│
▼
Open preview in system
image viewer
│
▼
┌─────────────────────┐
│ Interactive prompt │
└─────────────────────┘
│ │ │
save redraw quit
│ │ │
│ │ └── Delete temp file → Exit
│ │
│ └── Re-prompt options (with current
│ values as defaults) → Re-render
│ → Update preview → Loop
│
└── Ask for filename → Write PNG → Loop
Once the preview opens, you'll see this prompt in your terminal:
? What would you like to do? (Use arrow keys)
❯ save — save the PNG to a file
redraw — change options and regenerate
quit — exit without saving
| Command | What it does |
|---|---|
| save | Prompts for a filename (default: output.png). Writes the PNG to that path. Returns to the prompt so you can save again or continue. |
| redraw | Re-prompts for text, color, size, and font — with your current values pre-filled as defaults. Press Enter to keep any value unchanged. Re-renders and updates the preview. |
| quit | Deletes the temporary preview file from your system's temp directory and exits the tool cleanly. Any unsaved images are lost. |
- The temporary preview file (
/tmp/text-to-png-preview.pngon macOS/Linux) is deleted automatically. - Any PNG you already saved with
saveremains on disk — quitting does not remove those. - If you force-quit (Ctrl+C), the temp file may remain in
/tmp/until your OS clears it.