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

browser-image-optimizer-sdk

v1.0.0

Published

High-fidelity client-side image compression SDK guaranteeing < 2 MB output across JPEG, PNG, WEBP, AVIF with 1:1 original resolution retention.

Downloads

42

Readme

image-optimizer

Client-side image optimization library and SDK built to compress large image files (16 MB+ down to < 2 MB) while maintaining original pixel dimensions and visual fidelity.

Features

  • Original Resolution Retention: Reduces file size while preserving 1:1 pixel dimensions (width × height).
  • Adaptive Quality Control: Iteratively adjusts compression factors to meet target size constraints (< 2 MB).
  • Client-Side Execution: Operates entirely within the browser using HTMLCanvasElement and OffscreenCanvas for data privacy and zero server overhead.
  • Auto-Compress SDK: Embeddable JavaScript SDK (FileOptimizerSDK) that hooks into HTML <input type="file"> elements to automatically compress files prior to form submission.
  • Multi-Format Support: Supports WebP, AVIF, JPEG, and PNG input/output.
  • Batch Processing: Supports multi-file processing with automated ZIP archive exports.

Website SDK Integration

Option A: Automatic Input Intercept

Attach FileOptimizerSDK to an HTML <input type="file"> element:

import { FileOptimizerSDK } from './src/sdk/FileOptimizerSDK.js';

FileOptimizerSDK.attachToInput('#uploadInput', {
  maxSizeBytes: 2 * 1024 * 1024, // 2 MB target limit
  onSuccess: (files) => {
    console.log('Compressed file ready for upload:', files[0]);
  }
});

Option B: Programmatic Function Call

Use the compress() method for custom upload handlers:

import { FileOptimizerSDK } from './src/sdk/FileOptimizerSDK.js';

const inputFile = document.getElementById('myInput').files[0];

const compressedFile = await FileOptimizerSDK.compress(inputFile, {
  maxSizeBytes: 2 * 1024 * 1024
});

const formData = new FormData();
formData.append('image', compressedFile);

await fetch('/api/upload', {
  method: 'POST',
  body: formData
});

Setup and Development

Installation

cd image-optimizer
npm install

Development Server

npm run dev

Build Production Bundle

npm run build

License

Copyright © 2026 Gilang. All rights reserved.

Proprietary software. Unauthorized copying, modification, or distribution is strictly prohibited.