Directory / plugin
Pixelcinch Image Optimizer
v2.7.0 · by M Tayyab Atta
Converts your Media Library images to compressed WebP, targeting roughly 100KB per image.
About this plugin
Converts images to WebP and compresses each one toward a 100KB target:
- Media Library optimizer – scans existing attachments (JPG/PNG/GIF,
plus optional WebP/SVG/RAW support) and converts them to WebP in
small batches, avoiding PHP timeouts. - Manage WebP images – review any WebP image in your library, compare
visual quality before and after, compress individual images further,
restore originals, and choose exactly which original files to permanently
delete once you’re satisfied with results.
Compression modes
Choose one mode; it applies wherever conversion happens:
- Less Compress (quality mode): starts at WebP quality 90, only steps
down to a floor of quality 70, and never resizes the image. If a
detailed image can’t get under 100KB without going below that quality
floor, it is left larger rather than degraded further. - High Compress (aggressive mode): starts at quality 78, steps down to
a floor of quality 20, and if still too big, shrinks dimensions by
20% at a time down to a 120px floor – forcing the result under 100KB
“at any price.”
Requirements
- Imagick PHP extension with WebP support (preferred), or
- GD PHP extension with WebP support (imagewebp())
Security notes
- All admin actions require the
manage_optionscapability and a
verified nonce. - Every file this plugin processes is validated as a real image via
getimagesize() + fileinfo mime detection (or, for SVG, a dedicated
content-safety scan), not by trusting its extension. - Filenames are sanitized and destination paths are checked to stay
inside wp-content/uploads before any file is written. - All AJAX output is via wp_send_json_success/error; all admin UI output
is escaped (esc_html/esc_attr/esc_url).
The Media Library optimizer keeps your original files on disk; it only
repoints the attachment’s registered file to the new .webp version, so
you can restore from the original if needed – until you use the
“Delete original files” tool below.
For Developers
Extension points other plugins can hook into – none of these change
default behavior on their own, they’re no-ops until something uses them:
pixelcinch_after_convert(action) – fires after an attachment is
converted, with the attachment ID and a result summary array.pixelcinch_after_delete_original(action) – fires after an original
(pre-WebP) file is actually deleted from disk.pixelcinch_after_restore_original(action) – fires after an attachment
is reverted back to its original raster file.pixelcinch_compression_profile(filter) – the quality/resize tuning
values used for a given compression mode.pixelcinch_scannable_mime_types(filter) – the list of MIME types
offered as scan/convert source formats.pixelcinch_default_settings(filter) – the default settings array.pixelcinch_sanitize_settings(filter) – the sanitized settings array
right before it’s stored; add your own keys here alongside your own
entries inpixelcinch_default_settings.