Images and PDFs

  • images
  • webp
  • pdf
  • compression

Updated

Overview

Dirigible Optimize keeps uploaded images and PDFs small. There's nothing to set up. The Images card in Optimize Settings says what's on.

Uploads are compressed

Every image you upload is saved at a lighter quality, about a third smaller than WordPress makes it on its own, with no difference you can see on a page. This applies to the uploaded file and to every smaller size WordPress makes from it.

  • Hidden details are removed: the camera model, settings and the GPS location a phone stores in each photo. The colour profile stays, so colours look the same. A title or caption saved in the photo still becomes the image's title and caption in the Media Library.
  • PNGs with transparency, logos and screenshots are reduced to 256 colours when that makes them at least 20% smaller and they look the same. Photos with soft, see-through edges usually don't qualify and stay as they are.
  • Animated GIFs are left as they are.
  • New images are compressed: uploads as they arrive, and images that come in another way (an import, sample data, an image URL added in the editor, a feed) a few minutes later, in the background. Images already in the Media Library are only compressed if you start Compress older images (below).
  • While the site's previous image optimization plugin, or another image compression plugin, is active, that plugin compresses images with its own settings instead, and Optimize doesn't compress them a second time. See Other image plugins.

See what was saved

The Images card at the top of Optimize Settings totals what compression has saved so far: how many images and PDFs, and their size before and after. To get there from the Media Library, click Manage media optimization beside Add Media File.

For each file, switch the Media Library to its list view: the Savings column shows how much smaller the stored file is than the one uploaded, and what was done to it (resized from its original dimensions, saved as JPG). The smaller sizes WordPress makes from it are compressed too, but aren't counted, because there's no uncompressed copy to compare them with.

  • Older images that the site's previous image optimization plugin, Smush, Imagify or ShortPixel compressed show what that plugin saved, across all their sizes (or Already optimized where it didn't keep the sizes).
  • A dash means the file came in before Optimize compressed images, isn't an image, or is an imported image still waiting its turn (the Images card says how many are waiting). To compress older ones, see below.
  • Already optimized means compressing made that file less than 1% smaller (often only its hidden camera details came off).
  • PDFs show their saving once they've been compressed.

Compress older images

Images uploaded before Optimize compressed uploads can be compressed too. On the Images card, under Older images, click Compress older images.

  • What it does: each JPG and PNG in the Media Library, and every size WordPress made of it, is compressed the same way as a new upload. Hidden camera and GPS details are removed.
  • What stays the same: file names, dimensions and addresses, so nothing on your pages needs to change. Older images aren't resized or converted to JPG.
  • What's skipped: images that wouldn't get any smaller, images already compressed (on upload, by the site's previous image optimization plugin, or by Smush, Imagify or ShortPixel, even after that plugin is gone: compressing them again would only lower their quality), and the full-size original WordPress keeps beside a very large image.
  • Progress: it runs in the background, a few images at a time, and the card shows a progress bar and how much it has saved so far. While Optimize Settings is open, the progress updates by itself and the job runs a little faster. Stop pauses it; Continue compressing older images picks up where it stopped.
  • When you'll see it: your host keeps serving the old files from its cache for up to a year. When it finishes, the card (and a one-time message) says to purge the site cache in the Rocket.net dashboard so pages get the smaller files straight away (see Troubleshooting).
  • Later imports are compressed on their own, a few minutes after they arrive. If images are still left unchecked after a run (skipped by an earlier version of Optimize, say), the card offers Check again.

There's no undo: images are compressed in place, as new uploads are, and no copy of the original is kept. The card says so before you start.

Colour profiles stay: a PNG reduced to 256 colours keeps its colour profile (a Display P3 screenshot, say), so it looks the same.

Very large uploads are shrunk

A photo straight off a camera or phone is often 4,000 to 8,000 pixels wide, far bigger than any page shows. When you upload an image longer than 3,000 pixels on its longest side, Optimize shrinks it to 3,000 before it reaches the Media Library. That's enough for a full-width Hero on a large retina screen, such as a MacBook.

  • The Media Library keeps one file at that size, not the full original plus a smaller copy. A 4,000-pixel photo of about 1.8 MB typically ends up at roughly half that.
  • Images a little over 2,400 pixels (2,560, say) don't get a separate 2,400-pixel copy, which would be almost the same file twice. The uploaded file is used instead.
  • Phone photos stay the right way up, and their hidden details are removed (see above).
  • Images at or under 3,000 pixels, and animated GIFs, are left as they are.
  • Only files you upload are shrunk, as with the JPG conversion below. While the site's previous image optimization plugin is still active, it does this with its own settings instead.

If a client needs the full-size file (for print, say), upload it inside a .zip file, or share it from another service. There's no setting to keep full-size originals.

Large screens get large images, phones get small ones

For each image, WordPress gives the browser a list of its sizes, and the browser downloads the smallest one that's sharp on that screen. On its own, WordPress leaves anything wider than 2,048 pixels off that list, so the theme's 2,400-pixel size was never offered. A full-width Hero or Background on a 1,920-pixel desktop downloaded the full-size upload instead, which on many sites is 2,560 to 4,000 pixels wide.

Optimize adds each image's largest size to the list, plus the full-size file when it's 3,000 pixels or less. A 1,920-pixel desktop gets the 2,400-pixel file, and a retina laptop gets the 3,000-pixel one. Phones, tablets and smaller screens get the same sizes as before. This needs no setup and works for images already on your pages, once your host's cache refreshes them. Images uploaded before Optimize can have a full-size file over 3,000 pixels; those stay off the list.

WooCommerce uses the theme's image sizes

On a shop site, WooCommerce makes its own copies of every uploaded image, products or not, including a square crop. The Dirigible theme already has the sizes a shop needs, and squares come from its styling. So new uploads no longer get WooCommerce's copies: wherever WooCommerce shows an image (shop pages, the cart, checkout, the mini-cart, order emails), it uses the theme's sizes instead.

  • Images already in the Media Library keep their WooCommerce copies, so existing products look exactly the same.
  • Nothing is deleted.
  • WooCommerce's own regenerating of its image sizes is switched off, so it doesn't make the copies again.

New image sizes reach older images

When a Dirigible theme or plugin update adds an image size (or changes one), new uploads get it straight away, but images already in the Media Library don't. Optimize adds the missing sizes to those images in the background, a few at a time, so pages can use them. There's nothing to set up.

  • Pages first: images used as backgrounds (Hero, Background, sliders) come first, starting with the home page, then the other images in your content and featured images, then the rest of the Media Library, newest first.
  • Nothing is replaced: existing files and sizes are never changed or removed. An image is never enlarged: a size bigger than the image is skipped.
  • Progress: under Media → Background jobs in Dirigible → Tools & Maintenance, on the Adding new image sizes line. Run now does the next batch straight away; Retry stalled appears if the job stopped after repeated failures. People who manage media see a short message when a job started by new sizes has finished.
  • Publishing: if you publish a page that uses an older image still missing a size, that image goes to the front of the line.
  • Safe on busy sites: the job pauses when the server's disk is nearly full, slows down after errors, and stops after repeated failures rather than retrying forever.
  • Turning it off: deactivating Dirigible Optimize pauses it. When you reactivate, it picks up where it left off.

This job used to be part of the Dirigible theme. Progress made there carries over: it doesn't start again.

PNG and GIF uploads become JPGs

When you upload a PNG with no transparency, or a GIF that isn't animated, Optimize saves it as a JPG if that makes the file smaller, including smaller than the PNG reduced to 256 colours. Photos saved as PNG usually shrink 3 to 10 times. Screenshots, logos and icons usually stay PNG, which keeps their text and edges crisp.

  • The image is a JPG from the moment it lands in the Media Library: its file name, sizes and URL all end in .jpg. Nothing on your pages needs to change.
  • PNGs with transparent areas and animated GIFs are never converted.
  • Only files you upload are converted (Media Library, block editor, classic editor). Images that come in another way, such as sample data, imports or an image URL pasted into the editor, keep their format.
  • While the site's previous image optimization plugin is still active, Optimize leaves uploads alone: that plugin converts them with its own settings, and the card says so.

To keep every PNG and GIF as uploaded, check Keep PNG and GIF uploads as they are. It saves as soon as you check it.

Big PDFs are compressed

A PDF made for print can be 50 or 100 MB, mostly because its photos are at print resolution. Optimize compresses PDFs in the background, a minute or two after upload, with photos brought down to 200 dpi (still fine to print). The file keeps its address, so links to it keep working, and it's only replaced when that saves at least 20%. The PDF's pages and colours stay the same.

  • Automatically: new PDFs of 10 MB or more, unless they have accessibility tags, form fields, a signature or a password.
  • On request: any other PDF over 1 MB. Open it in the Media Library and click Compress PDF. If the PDF has accessibility tags, compressing removes them, so screen readers lose its headings and reading order. Keep the original if the PDF needs to be accessible. PDFs with form fields, a signature or a password are never compressed, because compressing would break them.
  • Results: the attachment screen shows the size before and after.
  • Restore original: the original is kept for 30 days. To put it back, click Restore original on the attachment screen. After 30 days it's deleted to free the space.
  • PDFs already in the Media Library are only compressed if you click the button.
  • Server requirement: PDF compression needs Ghostscript 10.03.1 or newer on the server, because older versions have security holes that a crafted PDF can use. Where the server's version is older, PDFs aren't compressed and there's no Compress PDF button. Images are compressed either way.

Your host may keep serving the old file from its cache for a while. To see the compressed one straight away, purge the cache (see Troubleshooting).

Other image plugins

Optimize already does what image compression plugins do, so you don't need one. If someone activates one anyway, the Plugins screen asks first and says what changes, and Optimize steps aside so no image is compressed twice. Optimize never deactivates these plugins: deactivate the plugin and Optimize handles new uploads again.

Plugin While it's active
Smush, Smush Pro It compresses images. Optimize's compression is off (the Savings column and Compress older images too). Very large uploads are still shrunk, PNGs still become JPGs when that's smaller, and PDF compression keeps working.
Imagify, ShortPixel Image Optimizer The same, except that it compresses PDFs too, so Optimize's PDF compression is off.
Optimole, ShortPixel Adaptive Images It serves your images from its own servers and compresses them there. Optimize's compression is off, as above; resizing, JPG conversion and PDF compression keep working.
WebP Express, Converter for Media Nothing changes in Optimize. These plugins make a WebP copy of every image, but your host already serves images as WebP, so the copies only take up space.

The Images card in Optimize Settings says when another plugin is compressing images.

Leftovers from a previous image plugin

Dirigible sites used to have an image optimization plugin make WebP copies of every image and lazy load them with a script. On Rocket.net neither is needed: Cloudflare already serves WebP to browsers that support it, and the Dirigible theme lazy loads images without a script. Optimize switches those features off and deactivates that plugin, since Optimize now does its other jobs, including any image CDN it ran (Dirigible sites don't use one). The leftover WebP copies are removed once in the background (keeping any that a page, field or the Media Library uses), and the plugin is removed from the site later. Both wait long enough for cached pages that still point at them to expire. Its settings stay stored, and media files are never touched. There's nothing to do.

Built by Dirigible Studio. Get in touch