@yireen/squoosh-browser

An image compression tool run in browser while @squoosh/lib can not.
16,437 35
Install
npm install @yireen/squoosh-browser
Latest Version:1.0.7
License:MIT
Last Updated:May 15, 2022
Links: GitHub  ·  npm
Maintainer: myeveryheart

squoosh-browser

An image compression tool run in browser while @squoosh/lib can not.

origin

Squoosh is an image compression web app that reduces image sizes through numerous formats.

Since @squoosh/lib can not run in browser, squoosh-browser is designed to solve it.

It can process almost all image formats, such as "pdf", "gif", "png", "jpeg", "bmp", "tiff", "webp", "webp2", "avif", "jxl".

installation

yarn add @yireen/squoosh-browser

If you use webpack4, you also need

yarn add file-loader --dev

config

For webpack5

// webpack.config.js
module: {
  rules: [
    {
      test: /\.wasm/,
      type: 'asset/resource'
    }
  ]
}

For webpack4

// webpack.config.js
module: {
  rules: [
    {
      test: /\.wasm/,
      use: [
        {
          loader: 'file-loader'
        }
      ]
    }
  ]
}

usage

import Compress from '@yireen/squoosh-browser'

  const compress = new Compress(image);
  const compressFile = await compress.process();
}

Related Packages

squoosh-browser-sense

An image compression tool run in browser while @squoosh/lib can not.

1,610 35
squoosh-compress

compress image use squoosh

588 19
super-image-cropper

A powerful JavaScript image cropping library that supports GIF animations, PNG,...

27,932 23
vue-heic-image

Vue 3 HEIC/HEIF image preview and converter for the browser: HeicImage component...

935 4
nuxt-image-optimizer

Nuxt module for on-demand image optimization with caching, responsive srcset/siz...

727 0

Version History

Version Released License
1.0.7 MIT
1.0.6 MIT
1.0.5 MIT
1.0.4 MIT
1.0.3 MIT