npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@zaro/img2html

v0.9.10

Published

CLI tool to convert images/screenshots to HTML+CSS using AI agents

Readme

img2html

AI-powered CLI tool that converts images and screenshots to HTML+CSS using LangChain agents.

Features

  • Converts images to responsive HTML+CSS code
  • Supports multiple frontend stacks: plain HTML/CSS or Tailwind CSS
  • Works with multiple LLM providers: OpenAI, Anthropic, OpenRouter, Google Gemini, MiniMax
  • Generates multiple variants for comparison
  • Stores generation metadata (tokens, params, conversation logs)
  • Can be used as a library in other Node.js applications

Installation

npm install @zaro/img2html
npm run build

Usage

CLI

img2html <image-path-or-url> [options]

Options:

| Option | Description | |--------|-------------| | -s, --stack <stack> | Frontend stack: "html_css" or "tailwind" (default: tailwind) | | -m, --model <model> | Model to use (e.g., "openrouter:qwen/qwen3.5-9b") | | -v, --variants <number> | Number of variants to generate (default: 1) | | -o, --output <dir> | Output directory | | -p, --prompt <text> | Additional instructions for the agent | | --max-width <pixels> | Scale image max width | | --max-height <pixels> | Scale image max height | | -t, --temperature <number> | Model temperature 0-1 (default: 0) |

Examples:

# Basic usage with OpenRouter
img2html screenshot.png --model openrouter:qwen/qwen3.5-9b

# With Tailwind, custom dimensions, and variants
img2html screenshot.png -s tailwind -m openrouter:anthropic/claude-3.5-sonnet --max-height 800 -v 3

# Using Anthropic
img2html screenshot.png --model anthropic:claude-sonnet-4-6

# Using Google Gemini
img2html screenshot.png --model gemini:gemini-2.0-flash

Library Usage

import { createAgentRunnerWithFile, createDefaultVfs } from 'img2html';

const vfs = createDefaultVfs('./output');
const logger = { log: (msg) => console.log(msg) };

const runner = createAgentRunnerWithFile(
  './screenshot.png',
  {
    stack: 'tailwind',
    modelConfig: {
      provider: 'openrouter',
      modelName: 'qwen/qwen3.5-9b',
      apiKey: process.env.OPENROUTER_API_KEY!,
      baseURL: 'https://openrouter.ai/api/v1',
      defaultHeaders: {
        'HTTP-Referer': 'https://github.com/img2html',
        'X-Title': 'img2html',
      },
    },
    logFile: '/_meta/conversation.json',
    storeImageAs: '/_meta/input-image.png',
    genParamsFile: '/_meta/gen-params.json',
  },
  vfs,
  logger
);

const result = await runner.run();
console.log(result.outputPath);

Environment Variables

| Variable | Description | |----------|-------------| | OPENROUTER_API_KEY | Required for OpenRouter models | | OPENROUTER_BASE_URL | Optional, defaults to OpenRouter API | | ANTHROPIC_API_KEY | Required for Anthropic models | | GOOGLE_API_KEY | Required for Google Gemini models | | MINIMAX_API_KEY | Required for MiniMax models | | IMG2HTML_STACK | Default stack | | IMG2HTML_MODEL | Default model | | IMG2HTML_VARIANTS | Default variant count | | IMG2HTML_OUTPUT | Default output directory |

Output Structure

output-dir/
├── index.html           # Generated HTML
└── _meta/
    ├── input-image.png  # Resized input image
    ├── conversation.json # Full conversation log
    ├── gen-params.json  # Generation parameters
    └── tokens.json      # Token usage summary

License

MIT