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 🙏

© 2024 – Pkg Stats / Ryan Hefner

browser-image-compress

v1.0.2

Published

A image compress tool work in browser

Downloads

12

Readme

简介

  • 一个不依赖服务器对图片进行压缩的库, 目前支持 png, jpeg, webp, bmp
  • 借助 wasm 的方式,让c++代码,和c++类库高效运行在浏览器里面
  • png 压缩使用了业界著名的 libpngquant,效果优异

使用

  1. 安装 npm install -S @edu/browser-image-compress
  2. 引入 & 使用
    import compress from '@edu/browser-image-compress'
    
    var fileDialog = document.querySelector('input[type=file]')
    var imgPreview = document.querySelector('img.preview')
    
    fileDialog.onchange = async ({ target: { files } }) => {
      let file = files[0]
      const result = await compress(file, {
        quality: 70, 
        maxWidth: 500, //最大宽度
        ditherring: 0.7, //色彩抖动水平
        mode: 2, //压缩模式,1为指定最大颜色数量,规则为 quality * 2; 2为自动计算最大颜色数量
        debug: true, // 打开日志开关
      })
      imgPreview.src =  URL.createObjectURL(res);
    }

TODO

  • [x] png 格式压缩
  • [x] jpeg, bmp格式压缩
  • [ ] gif 格式压缩

开发

  • js部分开发

    1. 安装依赖 npm run install
    2. 开发模式运行 npm run dev
    3. 生产模式编译 npm run build
    4. 运行demo npm run demo
  • c++部分开发

参考