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

opencode-image-resizer

v0.1.3

Published

OpenCode plugin that automatically resizes images over 5MB before sending to Claude API

Readme

opencode-image-resizer

OpenCode plugin that automatically resizes images over 5MB before sending to the Claude API.

Problem

Claude API has a 5MB limit per image. When you reference images in OpenCode (via @file or drag-and-drop), images exceeding this limit cause errors.

Solution

This plugin intercepts image reads and automatically resizes them using a ratio-based heuristic: it calculates how much the image needs to shrink and applies quality/resolution reduction in a single shot — no slow iterative scanning.

Install

Add to your opencode.json:

{
  "plugin": ["opencode-image-resizer"]
}

Configuration

Set via environment variables (e.g., in your shell profile or .env):

| Variable | Default | Description | |---|---|---| | IMAGE_RESIZER_MAX_SIZE_MB | 4.5 | Images above this size (MB) are resized. Max 5.0. | | IMAGE_RESIZER_MIN_QUALITY | 40 | Minimum JPEG quality (1–95). Plugin won't go below this. | | IMAGE_RESIZER_MIN_SCALE | 0.25 | Minimum resolution scale (0.1–1.0). 1.0 = never reduce resolution. |

# Example: higher quality, never reduce resolution
export IMAGE_RESIZER_MIN_QUALITY=65
export IMAGE_RESIZER_MIN_SCALE=1.0

How It Works

The plugin intercepts images at three points:

  1. read tool (@file references): When the LLM reads an image file over the limit
  2. chat.message: When you drag-and-drop an image into the terminal
  3. resize_image tool: Explicit LLM-callable tool for manual resizing

Resize Strategy

Given ratio = originalSize / maxSize, parameters are determined in one shot:

| ratio | quality | scale | Example | |---|---|---|---| | ≤ 1.1x | 93 | 100% | 5.0MB → 4.5MB | | ≤ 1.3x | 88 | 100% | 5.5MB → 4.5MB | | ≤ 1.6x | 83 | 100% | 7MB → 4.5MB | | ≤ 2.0x | 78 | 100% | 9MB → 4.5MB | | ≤ 2.5x | 72 | 95% | 11MB → 4.5MB | | ≤ 3.5x | 66 | 88% | 15MB → 4.5MB | | ≤ 5.0x | 58 | 80% | 22MB → 4.5MB | | ≤ 8.0x | 50 | 70% | 36MB → 4.5MB | | ≤ 15x | 45 | 55% | — | | 15x+ | 40 | 40% | — |

If the first attempt misses (edge case), a safety retry applies -15 quality and 80% scale. Maximum 3 attempts total.

For lossless formats (PNG, BMP, TIFF): lossless PNG re-compression is tried first (zero quality loss), then JPEG conversion with the heuristic above.

Supported Formats

jpg, jpeg, png, gif, webp, bmp, tiff, tif, avif

GIF: only the first frame is used.

resize_image Tool

Ask Claude directly when needed:

이 이미지가 너무 크면 resize_image 도구로 줄여줘: /path/to/image.png

Supports the same options as the env config, overridable per-call:

| Arg | Type | Default | |---|---|---| | filePath | string | required | | maxSizeMB | number | IMAGE_RESIZER_MAX_SIZE_MB | | minQuality | number | IMAGE_RESIZER_MIN_QUALITY | | minScale | number | IMAGE_RESIZER_MIN_SCALE |

License

MIT