🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@codetoimage/cli

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codetoimage/cli

Official CLI for codetoimage.app — render HTML/CSS to PNG/JPG/WebP from your terminal.

latest
Source
npmnpm
Version
0.2.0
Version published
Weekly downloads
2
-80%
Maintainers
1
Weekly downloads
 
Created
Source

@codetoimage/cli

Official CLI for codetoimage.app – render HTML/CSS to PNG/JPG/WebP from your terminal.

Install

npm install -g @codetoimage/cli

Or run without installing:

npx @codetoimage/cli render index.html -o out.png

Quickstart

# 1. Authenticate (paste an API key from https://codetoimage.app/dashboard/keys)
cti login

# 2. Render an HTML file
cti render hello.html -o hello.png

# 3. Or render inline HTML
cti render --html '<h1 style="font-family:sans-serif">Hi</h1>' -o hi.png

Examples

# JPEG at 1200×630, custom background
cti render og.html -f jpeg --quality 90 -w 1200 -h 630 --background "#0a0a0a"

# Separate CSS file
cti render card.html --css card.css -o card.png

# Transparent PNG (paid plans only)
cti render badge.html --transparent -o badge.png

# Get a temporary URL instead of bytes (hosted for 24h)
cti render og.html --url
# → https://img.codetoimage.app/r/abc123.png

# Named platform size instead of -w/-h (one template, many sizes)
cti render card.html --preset instagram-story
cti render card.html --preset og -o og.png
# Presets: og, twitter-card, facebook-post, linkedin-post, instagram-square,
#          instagram-portrait, instagram-story, youtube-thumbnail, pinterest-pin

# Render a saved template (dashboard → Templates) filling its {{placeholders}}
cti render --template 3f2a91d0-... --var title="Launch day" --var subtitle="v2.0 is out" -o launch.png

# Same template, every platform size, one loop
for p in og instagram-square instagram-story; do
  cti render --template 3f2a91d0-... --var title="Launch day" --preset "$p" -o "launch-$p.png"
done

Authentication

Three ways to supply your API key, in priority order:

  • --api-key <key> flag (per-call)
  • CODETOIMAGE_API_KEY environment variable
  • ~/.config/codetoimage/config.json (created by cti login, chmod 600)

Configuration

VariableDefaultPurpose
CODETOIMAGE_API_KEYAPI key (overrides stored config)
CODETOIMAGE_API_URLhttps://api.codetoimage.appAPI base URL (override for dev/proxy)

Exit codes

  • 0 – success
  • 1 – error (auth, validation, network, plan limit, …); details on stderr

Commands

cti login                    Save an API key locally
cti render [input]           Render HTML to image
cti --version                Print CLI version
cti --help                   Show help

Run cti render --help for the full flag list.

License

MIT

Keywords

html-to-image

FAQs

Package last updated on 11 Jul 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts