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

@kiliman/screenshot

v0.2.0

Published

Generate screenshots from HTML files using Playwright

Readme

@kiliman/screenshot

Generate high-quality screenshots from HTML files using Playwright.

Features

  • 🎯 Simple CLI interface
  • 🖼️ Support for PNG and JPEG formats
  • 📐 Customizable viewport dimensions
  • 🎨 Retina-quality output (2x device scale)
  • 🚀 Fast and reliable with Playwright
  • 📦 Zero configuration needed

Installation

# Use with npx (no installation required)
npx @kiliman/screenshot page.html

# Or install globally
pnpm add -g @kiliman/screenshot

Usage

Basic Usage

# Generate a PNG screenshot with default settings
npx @kiliman/screenshot page.html

# Specify output filename
npx @kiliman/screenshot page.html screenshot.png

# Use JPEG format
npx @kiliman/screenshot page.html --format jpg

# Use size presets for common social media platforms
npx @kiliman/screenshot page.html --size github
npx @kiliman/screenshot page.html --size og --format jpg
npx @kiliman/screenshot page.html --size twitter

# Custom dimensions
npx @kiliman/screenshot page.html --width 1920 --height 1080

# Output to specific directory
npx @kiliman/screenshot page.html --outdir ./screenshots

# Real example: The social preview image above was generated using this package!
npx @kiliman/screenshot assets/social-preview.html social-preview.jpg --outdir assets --size github --format jpg

Size Presets

Use --size to quickly generate screenshots optimized for different platforms:

| Preset | Dimensions | Description | |-------------|--------------|--------------------------------------| | github | 1280×640 | GitHub social preview | | og | 1200×630 | Open Graph (Facebook, LinkedIn) | | twitter | 1200×675 | Twitter/X card | | instagram | 1080×1080 | Instagram post (square) | | hd | 1920×1080 | HD/Full HD | | 4k | 3840×2160 | 4K/Ultra HD |

You can override preset dimensions with --width and --height:

# Use Twitter preset but make it wider
npx @kiliman/screenshot page.html --size twitter --width 1600

CLI Options

Usage: npx @kiliman/screenshot HTML_FILE [OUT_FILE] [OPTIONS]

Arguments:
  HTML_FILE              Path to the HTML file to screenshot (required)
  OUT_FILE              Output filename (optional, default: basename.format)

Options:
  --size PRESET         Use a size preset (github, og, twitter, instagram, hd, 4k)
  --width WIDTH         Viewport width in pixels (default: 1280)
  --height HEIGHT       Viewport height in pixels (default: 720)
  --format FORMAT       Image format: png, jpg, jpeg (default: png)
  --outdir DIR          Output directory (default: current directory)
  --help, -h            Show help message

Note: --width and --height override --size preset values

Programmatic Usage

You can also use this package programmatically in your Node.js projects:

import { generateScreenshot } from '@kiliman/screenshot';

// Using size preset
await generateScreenshot('page.html', 'output.png', {
  size: 'github',
  format: 'jpg',
  outdir: './screenshots'
});

// Using custom dimensions
await generateScreenshot('page.html', 'output.png', {
  width: 1920,
  height: 1080,
  format: 'png',
  outdir: './screenshots'
});

API

generateScreenshot(htmlFile, outputFile?, options?)

Generates a screenshot from an HTML file.

Parameters:

  • htmlFile (string, required): Path to the HTML file
  • outputFile (string, optional): Output filename (default: basename + format extension)
  • options (object, optional):
    • size ('github' | 'og' | 'twitter' | 'instagram' | 'hd' | '4k'): Size preset
    • width (number): Viewport width in pixels (default: 1280, overrides size preset)
    • height (number): Viewport height in pixels (default: 720, overrides size preset)
    • format ('png' | 'jpg' | 'jpeg'): Image format (default: 'png')
    • outdir (string): Output directory (default: current directory)
    • quality (number): JPEG quality 0-100 (default: 85, only for JPEG)

Returns: Promise - The full path to the generated screenshot

Requirements

  • Node.js 18 or higher
  • Playwright will automatically download required browser binaries on first use

License

MIT © Michael Carter

Author

Created by Michael Carter