=== PrinterFlo Image Optimizer ===
Contributors: printerflo
Tags: webp, avif, image optimizer, compress images, convert to webp
Requires at least: 6.0
Tested up to: 7.0
Stable tag: 1.0.3
Requires PHP: 7.4
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Truly unlimited WebP & AVIF conversion — runs in YOUR browser via WebAssembly. No API, no server, no credits, no signup. Ever.

== Description ==

**How this differs from every other image optimizer:** the other plugins in this category compress on a remote server (metered credits) or with your host's ImageMagick/GD (no AVIF on shared hosting). PrinterFlo Image Optimizer is, to our knowledge, the only one that runs the actual encoders (libwebp, libavif) as WebAssembly in the site owner's browser — which is why it can be unlimited and free, needs no API key, sends no images anywhere, and can produce AVIF on any hosting plan.

Every image optimizer plugin has the same catch: your images get sent to their servers, servers cost money, so you get metered — 100 images/month, 20 MB/month, "upgrade for bulk."

**This plugin has no server.** It converts your media library to WebP (and optionally AVIF) using WebAssembly running in your own browser — the same open-source encoders (Google's libwebp and libavif) that power professional optimization services, just running on your machine instead of theirs.

* **Truly unlimited** — 50 images or 50,000. There is nothing to meter.
* **No account, no API key, no signup** — install, click Optimize, done.
* **AVIF on any hosting** — shared hosts usually can't encode AVIF server-side. Your browser can. Get the most modern format on the cheapest hosting.
* **Zero server load** — your host does no conversion work at all.
* **Private** — images never leave your site. Nothing is sent to any third party.
* **Originals untouched** — converted files are saved alongside your originals; one click removes them all.
* **Automatic delivery** — front-end images are wrapped in `<picture>` tags so every visitor's browser picks the best format it supports. Works on any host — no .htaccess or nginx changes.

**How it works**

Open **Media → Image Optimizer** and click **Optimize all images**. Your browser fetches each image (and every thumbnail size), converts it with WebAssembly, and saves the result back to your media library. Keep the tab open while it runs — that's the whole trick that makes unlimited possible.

The one honest trade-off: because conversion happens in a browser, new uploads aren't converted automatically in the background. Revisit the page after adding images and run it again — already-converted files are skipped, so it only processes what's new.

Built by [PrinterFlo](https://printerflo.com/), print shop management software. Try the same engine online: [free bulk WebP & AVIF converter](https://printerflo.com/tools/webp-converter/).

== Installation ==

1. Install and activate the plugin.
2. Go to **Media → Image Optimizer**.
3. (Optional) Enable AVIF and adjust quality.
4. Click **Optimize all images** and keep the tab open until it finishes.

== Frequently Asked Questions ==

= Is it really unlimited? What's the catch? =

The conversion runs on your computer, in your browser — so there are no server costs and nothing to meter. The one trade-off: you have to open the optimizer page and keep it open while it works. For most sites that's a few minutes, once.

= Are my images sent anywhere? =

No. The plugin makes no external requests at all. Images go from your media library to your browser and back — encoder included in the plugin, running locally via WebAssembly.

= Does it modify my original images? =

Never. Converted files are saved as separate `.webp`/`.avif` files next to the originals. The "Remove all converted files" button deletes everything the plugin created, and your site is exactly as before.

= How are the images served to visitors? =

Front-end `<img>` tags whose files have a converted version get wrapped in a `<picture>` element with AVIF/WebP sources. Browsers automatically pick the best format they support and older browsers fall back to the original — no server configuration, works with page caching.

= WebP or AVIF? =

WebP is fast to encode and universally supported — it's always on. AVIF is 30–50% smaller than JPEG but slower to encode; enable it if you want maximum savings and don't mind the run taking longer.

= What about new uploads? =

They're converted the next time you open Media → Image Optimizer and click the button — already-done files are skipped. Background auto-conversion needs a server-side encoder, which is exactly the thing this plugin deliberately doesn't depend on.

= Which files are converted? =

JPEG and PNG attachments, including every registered thumbnail size. Transparency is preserved.

== External services ==

None. This plugin makes no requests to any external service. All image processing happens locally in the site administrator's browser using bundled WebAssembly encoders (libwebp and libavif via jSquash, Apache-2.0 licensed).

== Source code ==

The JavaScript in `assets/dist/` is built from the unminified sources in `assets/src/` (Vite; see `assets/src/vite.config.js`). Both are included in this plugin. To rebuild: `cd assets/src && npm install && npm run build`.

**About the `.wasm` files in `assets/dist/`:** these WebAssembly binaries ARE the image encoders/decoders — they are essential to the plugin (it performs all conversion in the browser, so without them it does nothing). They are the unmodified, pre-built codec binaries shipped by the open-source [jSquash project](https://github.com/jamsinclair/jSquash) (Apache-2.0), pulled in verbatim from the `@jsquash/webp` and `@jsquash/avif` npm packages by the build above:

* `webp_enc*.wasm` / `webp_dec*.wasm` — Google's [libwebp](https://chromium.googlesource.com/webm/libwebp) encoder/decoder, compiled to WebAssembly with Emscripten (build source: [jSquash codec directory](https://github.com/jamsinclair/jSquash/tree/main/packages/webp/codec)).
* `avif_enc*.wasm` / `avif_dec*.wasm` — [libavif](https://github.com/AOMediaCodec/libavif) + [libaom](https://aomedia.googlesource.com/aom/) encoder/decoder, same toolchain (build source: [jSquash codec directory](https://github.com/jamsinclair/jSquash/tree/main/packages/avif/codec)).

These codecs originate from the [GoogleChromeLabs Squoosh](https://github.com/GoogleChromeLabs/squoosh) project. Complete corresponding source and build instructions for every binary are at the links above.

== Changelog ==

= 1.0.3 =
* Documentation: the Source code section now fully documents the bundled WebAssembly codec binaries (what they are, why they're required, and links to their complete source and build instructions).
* Faster AVIF encoding on multi-core machines (multithreaded encoder used when the browser supports it).

= 1.0.2 =
* Renamed to PrinterFlo Image Optimizer (distinct, brand-prefixed name per directory guidelines).
* All internals re-prefixed from uio_ to pfio_.

= 1.0.1 =
* Fix: WebAssembly codecs failed to load on some sites (asset URLs are now relative to the plugin directory).
* Fix: browser cache-busting for the conversion worker on plugin updates.
* New: "Open optimizer" link on the Plugins screen and a first-run pointer notice.

= 1.0.0 =
* First release: unlimited in-browser WebP/AVIF conversion for the whole media library, `<picture>` delivery, one-click removal.
