squoosh Documentation

Make images smaller using best-in-class codecs, right in the browser.

25,683 stars TypeScript TypeScript 1 file ยท ~902 tokens
RAW Doc

Docker & Self-Hosted Deployment Verified OCI

Deploy squoosh on any server, homelab, or cloud container platform.

1-Click Terminal Command
bash (docker run)
docker run -d --name squoosh --restart always googlechromelabs/squoosh:latest

File: README.md

[Squoosh]!

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

Privacy

Squoosh does not send your image to a server. All image compression processes locally.

However, Squoosh utilizes Google Analytics to collect the following:

  • Basic visitor data.
  • The before and after image size value.
  • If Squoosh PWA, the type of Squoosh installation.
  • If Squoosh PWA, the installation time and date.

Developing

To develop for Squoosh:

  1. Clone the repository
  2. To install node packages, run:
    sh
    npm install
  3. Then build the app by running:
    sh
    npm run build
  4. After building, start the development server by running:
    sh
    npm run dev

Contributing

Squoosh is an open-source project that appreciates all community involvement. To contribute to the project, follow the contribute guide.


File: codecs/avif/enc/README.md

AVIF encoder

Example

Run example.js

API

`Uint8Array encode(std::string image_in, int image_width, int image_height, AvifOptions opts)`

Encodes the given image with given dimension to AVIF. Options looks like this:

c++
struct AvifOptions {
  // 0 = lossless
  // 63 = worst quality
  int minQuantizer;
  int maxQuantizer;

  // [0 - 6]
  // Creates 2^n tiles in that dimension
  int tileRowsLog2;
  int tileColsLog2;

  // 0 = slowest
  // 10 = fastest
  int speed;

  // 0 = 4:2:0
  // 1 = 4:2:2
  // 2 = 4:4:4
  int subsample;
};

File: codecs/avif/dec/README.md

AVIF decoder

Example

See example.html

API

`RawImage decode(std::string buffer)`

Decodes the given avif buffer into raw RGBA. RawImage is a class with 3 fields: buffer, width, and height.


File: codecs/hqx/pkg/README.md

HQX


File: codecs/hqx/README.md

HQX


File: codecs/imagequant/README.md

ImageQuant

Dependencies

  • Docker

Example

See example.html

API

`int version()`

Returns the version of libimagequant as a number. va.b.c is encoded as 0x0a0b0c

`RawImage quantize(std::string buffer, int image_width, int image_height, int numColors, float dithering)`

Quantizes the given images, using at most numColors, a value between 2 and 256. dithering is a value between 0 and 1 controlling the amount of dithering. RawImage is a class with 3 fields: buffer, width, and height.

`RawImage zx_quantize(std::string buffer, int image_width, int image_height, float dithering)`

???


File: codecs/oxipng/pkg/README.md

OxiPNG


File: codecs/oxipng/pkg-parallel/README.md

OxiPNG


File: codecs/oxipng/README.md

OxiPNG


File: codecs/resize/README.md

Resize