unwrite-images
v0.1.3
Published
Unwrite Images: Squoosh-based image tools with a simple mount API.
Maintainers
Readme
Unwrite Images - Image optimisation for Unwrite.co
Use it live: https://Unwrite.co/images
Unwrite Images is a fork of Squoosh that keeps everything client‑side and provides a simple mount API for embedding inside Unwrite (or any web app).
It helps you optimise images for the web: reduce file size while keeping quality, preview results side‑by‑side, and save the version that looks best.
Original repo
https://github.com/GoogleChromeLabs/squoosh
Please contribute here instead of via this repo - unless your contribution is specific to Unwrite Images!
For transparency, Unwrite Images is not associated with, or endorsed by, the Squoosh authors.
Privacy
All processing happens locally in your browser using Web Workers and WebAssembly. Images are not uploaded to a server.
Installation
Via NPM
npm install unwrite-imagesVia CDN (jsDelivr)
<script type="module">
import mountUnwriteImages from 'https://cdn.jsdelivr.net/npm/[email protected]/dist/mount.js';
const container = document.getElementById('image-editor');
const dispose = mountUnwriteImages(container);
</script>Usage
Mount API
import mountUnwriteImages from 'unwrite-images';
const el = document.getElementById('container')!;
const dispose = mountUnwriteImages(el, {
theme: 'inherit',
// Optional: Override CDN configuration
cdnBase: 'https://cdn.jsdelivr.net/npm/unwrite-images',
version: '0.1.1',
});
// Clean up when done
dispose();Options
theme: 'inherit' | 'light' | 'dark' (default: 'inherit')cdnBase: Optional CDN base URL overrideversion: Optional version for CDN URLs
CDN Hosting
When installed via npm and published, Unwrite Images is automatically available via jsDelivr CDN:
- Main bundle:
https://cdn.jsdelivr.net/npm/unwrite-images@VERSION/dist/mount.js - WASM codecs:
https://cdn.jsdelivr.net/npm/unwrite-images@VERSION/dist/chunks/codecs/
This significantly reduces the bundle size of your main application by loading image processing codecs on-demand from the CDN.
Developing
- Install dependencies
npm install - Build the project (generates static site build and the mount wrapper in
dist/)npm run build - Start the dev server for the static app
npm run dev
Branches
main- Stable production releasesdev- Active development
License
Licensed under Apache-2.0. See LICENSE and NOTICE for attributions and third‑party licences.
