Documentation / Pantry Images
Pantry Images
Contents: WebP on upload, using WordPress's own converter.
WebP on upload, using WordPress's own converter. Part of Plugin Pantry, built to the Pantry Standard.
What it does
- Converts the generated sizes of new JPEG and PNG uploads to WebP, through WordPress core's own
image_editor_output_formatfilter. No external service, no API key. - A status line on the settings screen saying whether this server's image library (Imagick or GD) can write WebP. When it cannot, the Enable switch is refused and turned back off on save, with an explanation.
- A quality setting for the generated WebP images.
- A switch to strip camera metadata (EXIF) from generated sizes.
- A maximum dimension for the scaled copy WordPress makes of a very large upload, or turn the scaled copy off entirely by setting it to 0.
- A Regenerate now button that rebuilds the generated sizes of every JPEG and PNG already in the media library, twenty attachments at a time in the background, with progress shown on the settings screen and a Stop button.
What it does not do
- No cloud or API compression, no external requests of any kind.
- No AVIF in the free plugin.
- No changes to originals: the file you uploaded is kept exactly as it was. Only the generated sizes (thumbnail, medium, large, and so on) are converted.
- No lazy-loading changes; WordPress already does that.
- No CDN, no image resizing on the fly.
These may appear in a separate Pantry Images Pro add-on later. The free plugin keeps working as-is either way.
Usage
- Go to Plugin Pantry > Images.
- Check the status line under "WebP". If the server cannot write WebP, ask your host to enable the Imagick or GD WebP extension; the switch stays off until it can.
- Tick Enable, set the Quality, Metadata and Maximum dimension fields, and save.
- New uploads from this point on get WebP generated sizes.
- To convert images already in the library, press Regenerate now. It processes twenty attachments at a time in the background, writing progress after each one; reload the page to see progress, and press Stop at any point to cancel the rest of the queue. Attachments already processed keep their new sizes. If a batch runs out of time on a slow server the screen says so and offers Resume, which carries on from the last image written.
Quality
Applies to the WebP output only. It replaces WordPress's default JPEG compression quality for any image whose generated sizes come out as WebP; it has no effect on a size that stays JPEG or PNG.
Maximum dimension
WordPress automatically makes one scaled copy of an upload larger than this on its longest side, and uses that copy as the effective original for cropping the other sizes (the file you uploaded is never touched). Lowering this number produces a smaller scaled copy; setting it to 0 turns the scaled copy off, so the full-size upload is used directly.
Regeneration
Regeneration only ever calls wp_generate_attachment_metadata() and wp_update_attachment_metadata() on existing JPEG and PNG attachments, using whatever the settings above are at the time each batch runs. It never touches the original uploaded file. One WordPress cron event, pantry_images_regenerate, is scheduled while a run is in progress and reschedules itself until the queue is empty; deactivating the plugin clears it and the progress it had made.