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.

Source
npmnpm
Version
0.1.1
Version published
Weekly downloads
6
-14.29%
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 (output:"url" mode — needs R2 backing)
cti render og.html --url
# → https://render.codetoimage.app/r/abc123.png

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 28 May 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