Deflato for WordPress

Automatically compress every image uploaded to your WordPress site. Up to 90% smaller files with no visible quality loss.

Download Plugin (v1.0.0)
43 KB · Requires WordPress 5.8+ · PHP 7.4+ · GPLv2 · Requires WordPress 5.8+ · PHP 7.4+ · GPLv2

Auto-Compress on Upload

Every image you upload is automatically optimized. Zero extra clicks needed. Works with Gutenberg, Elementor, Divi, and all page builders.

📦

Bulk Optimize

Compress your entire existing media library with one click. Progress bar, logging, and pause/resume support.

🎨

WebP & AVIF Output

Convert images to next-gen formats for maximum compression. Or keep the original format — your choice.

📊

Compression Stats

See how much you saved per image right in the Media Library. Dashboard shows total savings and uncompressed count.

🔄

Backup & Restore

Original files are safely stored. Restore any image to its original state with one click.

🔒

Thumbnails Too

Compresses all generated thumbnail sizes (medium, large, custom). Every size counts as one API call.

Lazy Loading

Native loading=lazy for offscreen images. Skips first 2 images (above the fold). Instant PageSpeed boost.

🌐

<picture> Tags

Automatically wraps images in picture with WebP/AVIF sources. Browser picks the best format with fallback.

🧠

Smart PNG → JPEG UNIQUE

Auto-detects PNG images without transparency and converts to JPEG — saving up to 70% extra. No other plugin does this!

💻

WP-CLI Commands

wp deflato optimize --all, wp deflato stats, wp deflato restore. Batch processing from terminal.

🎁

Free Trial

20 free API requests &mdash; no credit card needed. Test the plugin, see the results, then decide.

🤖

AI Image Generator NEW

Generate images from text prompts using 4 AI models: quick drafts, realistic photos, illustrations, and icons/logos. 15 design styles. Saved to Media Library. No other image plugin has this!

Installation

1

Download & Install

Download the ZIP, go to Plugins &rarr; Add New &rarr; Upload Plugin, select the file and click Install.

2

Get API Key

Sign up at deflato.com, upgrade to Pro ($7 one-time) or Creator ($25), and copy your API key from the Account page.

3

Configure

Go to Settings &rarr; Deflato, paste your API key, choose quality and format. Done!

4

Optimize

New uploads are compressed automatically. For existing images, go to <strong>Media → Deflato Bulk</strong> and click "Optimize All".

Why Deflato?

Feature ShortPixel Imagify Smush Pro Deflato
Auto-compress on upload
Bulk optimize
WebP conversion
AVIF conversion
Backup & restore
Pricing model $3.99/mo $7.99/mo $10/mo $7 once
Requires PayPal account No
Document compression (PDF, DOCX)
Lazy loading
<picture> tag serving
Smart PNG → JPEG
WP-CLI commands
AI Image Generator 4 models
Free trial (no card)

FAQ

Is this a subscription?

No. The Pro plan is a one-time payment of $7 for 30 days of access. No auto-renewal, no PayPal account needed. Pay with any card.

How many images can I compress per day?

Pro plan: 500 API calls/day. Each image + each thumbnail size = 1 call. A typical image with 4 thumbnails = 5 calls.

What about my existing images?

Use the Bulk Optimize page (Media → Deflato Bulk) to compress all existing images. Progress tracking and error handling included.

Can I go back to originals?

Yes. With "Backup Originals" enabled (default), every original is saved. Click "Restore" in the Media Library to get it back.

Does it work with my theme/builder?

Yes. Deflato hooks into WordPress core media handling, so it works with any theme, Gutenberg, Elementor, Divi, WPBakery, and more.

Are my images safe?

Files are sent to our server for compression over HTTPS, compressed, and immediately deleted. We never store your files.

Detailed Documentation

Settings Reference

<strong>Settings → Deflato</strong> — all plugin options:

  • <strong>API Key</strong> — your Deflato API key.
  • <strong>Compression Mode</strong> — three presets.
  • <strong>Output Format</strong> — Keep Original, JPEG, PNG, WebP, or AVIF.
  • <strong>Max Dimension</strong> — resize images larger than this.
  • <strong>Strip EXIF</strong> — removes metadata.
  • <strong>Compress Thumbnails</strong> — optimizes all thumbnail sizes.
  • <strong>Backup Originals</strong> — saves originals for restore.
  • <strong>Lazy Loading</strong> — adds loading=lazy to images.
  • <strong>Picture Tags</strong> — wraps img in picture with WebP/AVIF.
  • <strong>Generate WebP</strong> — creates .webp alongside originals.
  • <strong>Smart PNG → JPEG</strong> — auto-detects and converts.

WP-CLI Commands

For developers and server administrators. Requires WP-CLI installed.

# Optimize all uncompressed images
wp deflato optimize --all

# Optimize with limit
wp deflato optimize --all --limit=100

# Re-optimize already compressed
wp deflato optimize --all --force

# Optimize a specific image by ID
wp deflato optimize --id=123

# View compression statistics
wp deflato stats

# Restore a specific image
wp deflato restore --id=123

# Restore all images
wp deflato restore --all

Folder Scanner

Go to Media → Deflato Bulk and scroll down to Folder Scanner. Select folders to scan:

  • <strong>Active Theme</strong> — images in theme directory
  • <strong>Parent Theme</strong> — if using a child theme
  • <strong>Plugins</strong> — images bundled with plugins
  • <strong>Other Uploads</strong> — files outside Media Library

Click Scan — the scanner finds all images, sorted by size. Then click Optimize.

How Smart PNG → JPEG Works

When you upload a PNG, the plugin:

  1. Reads the PNG header to detect color type
  2. For RGB without alpha — converts immediately
  3. For indexed — checks for tRNS chunk
  4. For RGBA — scans ~500 pixels checking alpha
  5. If opaque → converts to JPEG with white background
  6. If transparent → keeps as PNG

Result: opaque PNGs converted to JPEG, saving 60-80% before API compression.

Hooks & Filters for Developers

// Skip lazy loading for specific images
<img src="hero.jpg" class="no-lazy">

// Skip picture wrapping for specific images
<img src="logo.svg" class="no-picture">

// Plugin uses these WordPress hooks:
wp_handle_upload        // Smart PNG→JPEG (priority 5)
wp_generate_attachment_metadata  // Auto-compress (priority 10)
the_content             // Lazy loading (99), Picture tags (100)

AI Image Generator NEW

Generate images directly from text descriptions. Go to <strong>Media → AI Generate</strong>.

4 AI Models:

Quick Backgrounds, textures, fast drafts ~5s
Photo Banners, hero images, best text rendering ~30s
Design Illustrations, art, 15 styles (pixel art, hand drawn, HDR...) ~10s
Icon Logos, app icons, line art (SVG quality) ~12s

AI Generation Limits:

Free trial 3 generations total
Pro ($7) 2 generations/day
Creator ($25) 10 generations/day
Day Pass ($2) 2 generations/day

Each generation uses 1 API request from your AI limit (separate from compression). Powered by Deflato AI.

File Structure

deflato-image-optimizer/
  deflato-image-optimizer.php    # Main plugin file
  uninstall.php                  # Cleanup on delete
  readme.txt                     # WordPress.org format
  includes/
    class-deflato-api.php        # API client
    class-deflato-settings.php   # Settings page
    class-deflato-media.php      # Upload hooks, Media column
    class-deflato-bulk.php       # Bulk optimize page
    class-deflato-frontend.php   # Lazy loading, picture tags
    class-deflato-smartconvert.php # PNG→JPEG detection
    class-deflato-scanner.php    # Folder scanner
    class-deflato-cli.php        # WP-CLI commands
  admin/
    css/deflato-admin.css        # Admin styles
    js/deflato-admin.js          # AJAX handlers

Ready to speed up your WordPress site?

Download the plugin, get your API key, and start compressing.

Download Plugin (v1.0.0)