WebP and AVIF images: automatic conversion and delivery
The Images tab (Baza Helper > Images) makes smaller copies of your pictures and serves them to browsers that can show them. Original files, attachment IDs, alt text and dimensions stay as they are.
Turn it on
- Open the Images tab and check Server support. A format your server cannot encode is shown as unavailable and is skipped.
- Switch on Enable image manager.
- Press Generate missing images. The job runs in the background through WP-Cron, so you can close the tab.
WebP is available in the free plugin. AVIF is a Pro feature.
Formats and quality
- Automatically compress new images converts new uploads in the background.
- Generate WebP and WebP quality. Generate AVIF and AVIF quality with Pro.
- Keep only files smaller than the original throws away a copy that did not save anything.
Which images are converted
- Include responsive image sizes and Include full-resolution originals.
- Include theme image assets and Include plugin images (the booking calendar and others).
- Convert images found on pages automatically converts any local picture that a page, stylesheet or script asks for, so pictures from page builders and plugins are covered, not only the media library.
Animated images are kept without conversion. An image above the pixel limit is skipped with a message, and you can raise Maximum source size (megapixels) to convert it. Files per cron batch and Batch time budget (seconds) are read on every cron tick, so a change affects a job that is already running.
Delivery on the site
- Automatically switch images puts the best supported format in front of the original, with the original as the fallback. Existing picture elements and external images are left alone.
- Automatically switch backgrounds and CSS covers CSS backgrounds through generated copies of the stylesheets.
- Support dynamically inserted images handles pictures that scripts add after the page loads.
- Clear supported page caches when the job completes makes new pages use the new files.
Generation queue
The queue card shows media processed, image variants processed, formats generated, skipped, errors and bytes saved. Use Pause, Resume, Retry errors and Cancel job to control it. Regenerate all images encodes every copy again, also those that exist, and asks for confirmation first because it can take long. A file that stops the worker three times (time or memory limit) is skipped, listed as an error and kept. Retry errors runs it again. Errors listed by an older version have no saved task, so the button then runs Generate missing images, which meets those files again. If a big file fails again, make it smaller or raise the PHP memory and time limits. The buttons Pause, Resume, Retry errors and Cancel job appear only when they apply.
Regenerate all images looks through the whole theme folder, not only its assets folder, so a theme that keeps pictures in an img folder also gets WebP, AVIF and phone-sized copies. It skips node_modules, vendor, .git, tests, languages and src, and reads at most 3000 files. Phone-sized copies (900 px wide) are also made for pictures that are already WebP or AVIF, when the source is wider than 1000 px.
One image from the media library
When the image manager is on, the Edit Media screen of a picture has a WebP / AVIF row with Generate for this image and Regenerate. It converts the full image and all its sizes at once and shows the bytes saved.
WP-CLI
For large libraries, servers without cron and deploy scripts, the same job runs in the terminal with a progress bar:
wp baza-helper images generate
wp baza-helper images generate --enable
wp baza-helper images generate --retry
wp baza-helper images generate --force
wp baza-helper images status --format=json
wp baza-helper images pause
wp baza-helper images cancel- generate converts the library and skips images that already have a current copy, so it is safe to run again.
- –enable turns the image manager on first. Without it the command stops with a message when the manager is off.
- –retry runs only the files that failed. –force encodes every copy again. The two cannot be combined, and a running job must be cancelled first.
- status shows the job, the counts, the size saved and whether this server can encode WebP.
- pause and cancel stop the current job. Copies already made are kept.
If WP-CLI prints a parse error from a WordPress core file, the shell’s default PHP is older than the site’s. Run WP-CLI with the site’s PHP binary.
