Images and PDFs

  • images
  • 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 (see Colour profiles for the two kinds that don't). 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 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 Optimize already compressed, and the full-size original WordPress keeps beside a very large image.
  • Images another plugin compressed (the site's previous image optimization plugin, Smush, Imagify or ShortPixel, even after that plugin is gone) aren't compressed again, because that would only lower their quality. They lose only what can come off without touching the picture: hidden details, and a colour profile the page can't use (see Colour profiles). To compress one of them fully anyway, see Re-optimize one 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, the card offers Check again. After updating from Optimize 0.0.93 or older, that includes every image another plugin compressed: earlier versions skipped them without looking at their files.

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.

Re-optimize one image

To compress a single image again, whatever was done to it before, open it in the Media Library and click Re-optimize image. Administrators see the button on JPG and PNG images.

  • What it does: the same as Compress older images, for this image and all its sizes, straight away. It ignores the record that another plugin (or Optimize) already compressed the image, so use it for an image that still looks too heavy, such as one PageSpeed flags.
  • Quality is protected: a file is only compressed again when that makes it at least 10% smaller. Otherwise only its hidden details and unneeded colour profile come off.
  • Afterwards the screen shows the image's size before and after, all sizes together, or says it's already as small as it gets.
  • When you'll see it: your host keeps serving the old files until its cache is purged, as above.
  • Not run: if images are being compressed in the background at that moment, the screen says so. Try again in a minute.

There's no undo here either.

Colour profiles

A colour profile tells the browser how to show an image's colours. Optimize keeps the ones a page uses: sRGB, Display P3, Adobe RGB and other screen profiles, on JPGs and PNGs (a Display P3 screenshot reduced to 256 colours keeps its profile, so it looks the same).

Two kinds are removed from JPGs, because they make every size of the image much bigger for nothing:

  • A profile that doesn't match the image, such as a CMYK print profile saved into an ordinary RGB photo. Browsers ignore it, so the image looks exactly the same without it. One such profile added half a megabyte to every size of a photo, thumbnails included.
  • A large printer or scanner profile (over 16 KB) on an RGB photo. Optimize applies it, so the colours are converted to standard sRGB, and then removes it. The image looks the same in the browser. This happens only when the image is compressed again, and only where the server's image software can convert colours; otherwise the profile stays.

This applies to new uploads and their sizes, imports, Compress older images and Re-optimize image.

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 EWWW Image Optimizer is 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.

Upload size limit

Files up to 32 MB can be uploaded to the Media Library, enough for photos, PDFs and short videos. A bigger file is refused as soon as you pick it, with "exceeds the maximum upload size for this site", instead of uploading for minutes and then failing with a network error.

To change it, open the Images card in Optimize Settings, pick a size under Upload size (2 MB to 256 MB) and click Save upload size. Upload screens show the limit in effect ("Maximum upload file size").

  • Larger than 256 MB isn't offered: an upload that size doesn't make it through the host's network, whatever the server allows.
  • A much lower limit than you picked (2 MB, say) comes from the server's settings, not from Optimize. The card says so, and sizes above it are marked "more than this server allows": ask the host to raise PHP's upload_max_filesize and post_max_size.
  • A video for a Hero or background has to be uploaded before Dirigible Blocks' Optimize for web can make its web-sized copy, so the original must fit under the limit. Phone videos are often 50 MB or more: raise the limit to 64 or 128 MB while you upload it, or trim it or export it at 1080p first.

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.

  • Newest first: it works through the Media Library from the most recent upload back, since recent images are the likeliest to be on your pages.
  • 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 Tools, 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.
  • 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 EWWW Image Optimizer is 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
EWWW Image Optimizer It compresses images and PDFs with its own settings, and it shrinks and converts uploads too, so Optimize's compression, resizing, JPG conversion and PDF compression are all off. Its WebP copies and lazy load stay off (see below).
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.

WebP copies and lazy load scripts

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. If EWWW Image Optimizer is activated, its WebP copies, WebP rewriting and lazy load stay off, whatever its settings say.

Built by Dirigible Studio. Get in touch