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

@miconvert/browser-image-compression

v1.2.0

Published

Smart browser-side image compression with target file size, auto-resize, WebP conversion, and EXIF orientation fix.

Readme

@miconvert/browser-image-compression

🖼️ 智能浏览器端图片压缩 — 设定目标文件大小,库自动完成压缩。

npm version License: MIT

🌍 其他语言: English | Tiếng Việt | 中文 | 日本語 | 한국어 | Español | Português | Français | Deutsch | Русский | हिन्दी | العربية | Bahasa Indonesia | ภาษาไทย | Türkçe | Italiano | Polski | Nederlands | Bahasa Melayu | Українська | Svenska | বাংলা

功能特性

  • 🎯 智能压缩 — 设定目标大小(如500KB),自动寻找最优质量
  • 📐 自动缩放 — 按最大宽高缩放,保持纵横比
  • 🔄 EXIF方向修正 — 自动修复iPhone/Samsung照片旋转问题
  • 🖼️ WebP转换 — 转换为现代格式,文件更小
  • Web Worker — 后台线程压缩,不阻塞UI
  • 📊 进度回调 — 实时显示压缩进度
  • 💧 水印 — 添加文字或图片水印
  • 📝 Base64输出 — 获取Data URL用于即时预览

安装

npm install @miconvert/browser-image-compression

快速开始

import imageCompression from '@miconvert/browser-image-compression';

const compressedFile = await imageCompression(file, {
  maxSizeMB: 1,              // 目标 ≤ 1MB
  maxWidthOrHeight: 1920,    // 超过则缩放
  useWebWorker: true,        // 后台线程
  onProgress: (p) => console.log(`${p}%`),
});

完整选项

const result = await imageCompression(file, {
  maxSizeMB: 0.5,              // 目标文件大小(MB)
  maxWidthOrHeight: 1920,      // 最大宽度或高度(px)
  initialQuality: 1,           // 初始质量(0–1)
  fileType: 'image/webp',      // 输出格式
  useWebWorker: true,          // 使用Web Worker(默认:true)
  exifOrientation: true,       // 修正EXIF方向(默认:true)
  outputType: 'base64',        // 'file' 或 'base64'
  onProgress: (p) => {},       // 进度回调(0–100)
  watermark: {                 // 可选水印
    text: '© 品牌名称',
    position: 'bottom-right',
    opacity: 0.3,
  },
});

API参考

| 选项 | 类型 | 默认值 | 说明 | |--------------------|------------|-----------|------------------------------------------| | maxSizeMB | number | — | 目标最大文件大小(MB) | | maxWidthOrHeight | number | — | 最大宽度或高度(px) | | initialQuality | number | 1 | 初始质量(0–1) | | fileType | string | 同输入 | 输出MIME类型 | | useWebWorker | boolean | true | 在Web Worker中运行 | | onProgress | function | — | 进度回调 (百分比) => void | | outputType | string | 'file' | 'file'返回File,'base64'返回Data URL | | exifOrientation | boolean | true | 自动修正EXIF方向 | | watermark | object | — | 水印配置 |

浏览器支持

Chrome 64+, Firefox 62+, Safari 12+, Edge 79+

🆘 技术支持与Bug反馈

如果您遇到任何Bug、问题或需要帮助,请通过以下方式联系我们:

👉 miconvert.com/en/contact

我们会在24小时内回复所有咨询。您也可以在GitHub上提交issue,但为了获得最快的响应,推荐使用我们的联系页面。

许可证

MIT © Miconvert