Your gallery looks great on your laptop. Then a client opens it on a phone over hotel Wi-Fi, and the photos crawl in one gray tile at a time.
The good news: you don’t need a degree in web performance to optimize images in WordPress for a gallery. You need a handful of moves, and your gallery plugin may already make some of them for you.
Why gallery pages get slow (and how to measure it)
Gallery pages get slow because they ask the browser for dozens of photos at once, and photos are already the heaviest thing on the web. The median home page weighs 2.56 MB on mobile and 2.86 MB on desktop. Images take the biggest share of that: 911 KB on mobile and just over 1 MB on desktop (Web Almanac 2025).
Now picture a wedding portfolio with 60 photos in a Masonry grid. At just 50 KB per thumbnail, that’s 3 MB of images if they all load at once, more than that whole median page.

Speed matters for people and for Google. Nobody waits for a portfolio: a gallery that shows up fast gets browsed, and a slow one gets closed.
Google rates a page “good” when its Largest Contentful Paint (LCP), the moment the largest visible image or text block appears, is 2.5 seconds or less at the 75th percentile of page loads. The other two Core Web Vitals ask for Interaction to Next Paint (INP) at 200 ms or less and Cumulative Layout Shift (CLS) at 0.1 or less (web.dev).
They’re one ranking signal among many. Speed won’t rescue a weak page, but a slow one starts behind.
Measure before you change anything
Run the gallery page through PageSpeed Insights on the Mobile tab and write down three things:
- The LCP time, and which element it is. On a gallery page, it’s often the first photo.
- The image warnings. PageSpeed Insights now lists them under Improve image delivery: images that could be smaller without visible quality loss (DebugBear, updated December 2025).
- The total page weight, so you can see what each change saves.
Then change one thing at a time and test again, so you know what helped.
Optimize images in WordPress, starting with what you upload
The easiest way to optimize images in WordPress is to never upload a giant one. Export each photo at about 2,000 to 2,560 pixels on the long edge, as a JPEG, and you’ve done most of the work before WordPress even sees the file.
Why that range? When you upload a photo, WordPress creates several smaller sizes of it. If the photo is wider or taller than 2,560 pixels, PNGs included, it also saves a scaled-down copy with “-scaled” in the name. That copy becomes the “full” image, a rule that arrived in WordPress 5.3 and still applies in WordPress 7.1.3.
Modula’s lightbox and zoom show that “full” file. So a 6,000-pixel camera original never reaches your visitors; it only costs you upload time and disk space. Export at 2,560 px or less yourself, and you decide the sharpening and quality, not WordPress.

Tip
Uploading 300 wedding proofs? Save an export preset at 2,048 px on the long edge in Lightroom or Capture One and use it every time. No Lightroom? PicResize or Photoshop can resize, and TinyPNG compresses a batch in your browser before you upload.
Is PNG or JPEG better for WordPress?
JPEG beats PNG for photos, and WebP or AVIF are smaller still if your editor exports them. Keep PNG for logos, screenshots and graphics with transparency. A photo saved as PNG is far heavier than the same photo as a JPEG, with no visible gain.
WordPress has accepted AVIF uploads since version 6.5, as long as your server’s image library supports the format (make.wordpress.org). It also re-saves every size it generates at quality 82 for JPEG and 86 for WebP (WordPress developer docs). That’s a sensible default for most sites.
Let the gallery serve the right image size
In a Modula gallery, leave Layout → Image file size on Medium, the default, and let the browser do the picking.
Here’s why. In Modula 3.0, every gallery image gets a responsive srcset, a menu of sizes built from a 1,600 px base, and Modula tells the browser how wide each tile really is on screen. The browser then downloads the file that fits: a small one for a three-column grid on a phone, a bigger one for a wide column on a retina laptop.
So Medium doesn’t look soft, even in wide columns. The advice to pick a bigger WordPress image size for sharpness comes from the core Gallery block, and a Modula gallery doesn’t need it.

Change the setting only when you want Modula to crop every tile to a fixed width and height. Pick Custom, enter the Custom dimensions and turn on Crop images to fit. Modula still gives the browser cropped copies up to 1,600 px wide, so cropping doesn’t cost you sharpness either.
For phones and tablets, see the mobile responsive gallery guide and the responsive settings in the KB.
Lazy load gallery images (except the first ones)
Lazy loading means the browser downloads a gallery image only when it’s about to scroll into view. In Modula it’s free and already on, so photos at the bottom of a long gallery wait until someone scrolls down to them.
The switch lives in each gallery under Layout → More settings → Speed Up → Loading → Load images as people scroll. It uses the browser’s own lazy loading (loading="lazy"). It sits in the Speed Up panel, but you don’t need the paid Speed Up extension to use it.
The exception: galleries at the top of the page
When the switch is on, Modula lazy loads every image in the gallery, the first row too. That’s perfect halfway down a post. It’s a problem when the gallery is the first thing visitors see, because the browser holds back the very photos that make up your LCP.
Google’s web.dev team measured this on WordPress. Pages with lazy loading had a slower median LCP (3,768 ms) than pages without it (3,495 ms). When the test stopped lazy loading the images above the fold, the slowdown disappeared (web.dev, 2022).
What that means for your galleries:
- A small gallery at the top, like a 10-photo Slider opening a blog post: turn Load images as people scroll off for that gallery.
- A big gallery at the top, like a 60-photo portfolio: keep it on and split the gallery into pages.
- A gallery further down: leave it on.
Split big galleries into pages
A 300-photo wedding gallery doesn’t need to load all at once. Turn on Layout → Pagination, then open Page size & navigation. Set Images per page for Desktop and Mobile, and choose how visitors move on: page links, Show a Load more button or Infinite scroll.
Try 24 per page on desktop and 12 on mobile, with a Load more button. Visitors see the first photos fast and pull in more when they want.
Pagination comes with the Business plan. It works on Masonry, Creative, Polaroid and the grid types, not on Slider, Story, Showcase, Canvas, Parallax, BnB or Video gallery (which type is which). The pagination guide has the details.

Compress gallery images with Speed Up
Speed Up compresses a Modula gallery’s images as they’re delivered, with one level for the grid thumbnails and another for the large lightbox photo. We make Modula, so here’s exactly how it works in 3.0, limits included.
Set it up in three steps:
- Turn on the extension. In Modula → Extensions, switch on Speed Up. Trio and up include it, with unlimited compression (pricing page, October 2026).
- Pick a site default. In Modula → Settings → Performance → Image compression, set Compression to Lossless, Lossy or Glossy. It starts Off, so galleries left on Site default stay uncompressed until you pick a level.
- Fine-tune any gallery. Open Layout → More settings → Speed Up and look under Files, which appears once the extension is on. Set Thumbnail compression and Lightbox compression to Site default, Lossless, Lossy, Glossy or Off.
The first setting under Files, Use smaller modern image files, turns compression on or off for that one gallery, whatever the site default says.



Lossless, glossy or lossy?
All three shrink the file; they differ in how much they change it:
| Level | What it does | Good for |
|---|---|---|
| Lossless | Strips redundant data; every pixel stays the same | Fine-art lightboxes, where quality comes first |
| Glossy | Drops a little detail you’d struggle to spot | Most photographers, thumbnails or lightbox |
| Lossy | Drops more data for the smallest file; can show up close | Thumbnails in big grids |
Glossy is usually the best pick for photographers and artists. The difference is nearly impossible to see, and the file ends up smaller than lossless could make it.
Tip
Start with thumbnails on Glossy or Lossy and the lightbox on Lossless or Glossy. There are dozens of small thumbnails, so the savings add up. The lightbox shows one photo, big, to someone looking closely.
What Speed Up does behind the scenes
When the page renders, Modula points every gallery image, and every srcset size, to Modula’s image CDN (content delivery network). Thumbnails are requested at tile size and the lightbox photo at its own dimensions. Album lightboxes get the same treatment.
Your originals in the Media Library are never touched. There’s no bulk job and nothing to restore: switch Speed Up off and the gallery goes straight back to your own files.

A few limits:
- Same format out. A JPEG comes back as a smaller JPEG, never WebP or AVIF.
- Your domain only. Images offloaded to Amazon S3 or another CDN are skipped.
- Live sites only. Local and staging sites stay locked and show “Not available on a local site.”
- No Video gallery. The Speed Up panel is hidden for that type.
WebP and AVIF: what helps and what Modula does
WebP and AVIF usually make smaller files than JPEG at the same visible quality, and AVIF now works in about 96% of browsers in use (caniuse, checked October 2026). Modula doesn’t convert to either. It shows the file you uploaded, and Speed Up returns that same format.
Don’t let the label Use smaller modern image files fool you. It’s the gallery’s on/off switch for compression, not a format converter.
That leaves two routes to modern formats in a gallery:
- Upload them. Export WebP or AVIF from your photo editor and add them like any other image. Modula’s ZIP and server-folder imports skip AVIF, so add AVIF files through the Media Library.
- Let an optimizer create them. ShortPixel, Imagify, EWWW and Smush can all make WebP and AVIF copies, though EWWW needs a paid plan for AVIF and Smush for both. Many swap the new files in with
<picture>tags or JavaScript. We haven’t verified that with Modula 3.0’s gallery front end, so check your browser’s Network tab for the file type that actually loads.

WordPress image optimization plugins, compared fairly
A WordPress image optimizer plugin earns its place when you need something a gallery plugin doesn’t do. That means compressing images outside your galleries, bulk-optimizing the Media Library you already have, or creating WebP and AVIF copies. Modula’s Speed Up compresses at delivery, so it has no bulk job.
Here are the four you’ll run into most, with limits and prices from each vendor’s own pages (checked October 2026):
| Plugin | Free version | Cheapest paid plan | WebP / AVIF | Active installs |
|---|---|---|---|---|
| ShortPixel | 100 image credits a month; lossy, glossy or lossless | $9.99/month unlimited, or one-time credits from $19.99 | Both | 300,000+ |
| Imagify | 20 MB a month (about 200 images), 2 MB max per image | Growth: $5.99/month, or $4.99/month billed yearly (500 MB) | Both, on the free plan too | 900,000+ |
| EWWW Image Optimizer | Unlimited lossless compression on your own server, plus WebP | Standard: $8/month or $80/year, with the Easy IO CDN | WebP free; AVIF through Easy IO | 1+ million |
| Smush | Lossless and lossy, plus lazy load; skips images over 5 MB | Smush Pro, through WPMU DEV | Pro only | 1+ million |
So which is the best image optimizer for WordPress? There’s no single winner. Pick by need:
- Free and unlimited: EWWW’s free mode.
- Glossy compression and AVIF, pay as you go: ShortPixel.
- A small blog with a few uploads a month: Imagify’s free plan.
- Already paying for WPMU DEV: Smush Pro.

Two rules keep any of them friendly with your gallery:
- One optimizer at a time. Two compression plugins on the same uploads just get in each other’s way (NitroPack gives the same advice).
- One image CDN per image. Upload compression works alongside Speed Up, but don’t let Easy IO, Smush’s CDN or Optimole also rewrite gallery images that Speed Up handles.
Cache pages and use a CDN
Caching keeps ready-made copies of your pages and images so they aren’t rebuilt or downloaded again. A CDN serves those copies from a server close to each visitor. Three kinds of caching matter:
- Browser caching keeps images on the visitor’s device, so returning visitors don’t download them again.
- Page caching, through your host or a caching plugin, saves WordPress from rebuilding the gallery page on every visit.
- CDN caching keeps copies in data centers around the world, called points of presence (PoPs), so first-time visitors get them fast too.

If Speed Up is on, your gallery images already come from Modula’s image CDN. For the rest of the site, you have three options:
- Your host’s CDN, if your plan includes one.
- Cloudflare’s free plan, a free CDN for images and the rest of your static files. Its image compression feature, Polish, needs Pro or higher (Cloudflare docs).
- Bunny CDN, at $0.01 per GB in Europe and North America, with a $1 monthly minimum (bunny.net, checked October 2026).
Choosing an image CDN for photographers
Photography sites push a lot of image data, so check three things before you pick a CDN:
- Price per GB. A busy portfolio can use far more bandwidth than a blog.
- Locations near your clients. A wedding photographer in Texas needs fast US nodes more than Asian ones.
- Hotlink protection, covered next.
Stop hotlinking
You stop hotlinking at your server or CDN, by refusing image requests that come from other websites. Hotlinking is when another site embeds your photos straight from your file URL. Their page shows your image, and your server pays for the bandwidth.
Three ways to block it:
- Cloudflare: turn on Hotlink Protection. It checks where each request comes from (the Referer header) and covers GIF, ICO, JPG, JPEG and PNG, but not WebP or AVIF (Cloudflare docs, checked October 2026).
- Your host: many control panels, cPanel included, have a Hotlink Protection screen.
- Your server config: a rewrite rule in
.htaccesson Apache, or in the Nginx config.
Right-click protection won’t stop hotlinking, because a hotlinker never loads your page; they point straight at the image file. Modula’s Image Guardian (Trio plan and up) stops casual “Save image as” on your own pages. See how to disable right-click on images and ways to protect images from theft.
A quick checklist
Nine steps speed up a WordPress gallery, in the order this guide covers them:
- Test the gallery page in PageSpeed Insights and note the LCP.
- Export photos at 2,000 to 2,560 px on the long edge, as JPEG, WebP or AVIF.
- Leave Image file size on Medium; use Custom only to crop tiles.
- Keep Load images as people scroll on, except for a small gallery at the very top.
- Split big galleries into pages (Business plan).
- Turn on Speed Up (Trio and up): thumbnails Glossy or Lossy, lightbox Lossless or Glossy.
- Add page caching and a CDN.
- Block hotlinking at the server or CDN.
- Test again, aiming for an LCP of 2.5 seconds or less (web.dev).
Frequently asked questions
Yes: free Modula, with 160,000+ active installations, already lazy loads gallery images and gives each tile a responsive srcset, so the browser downloads a file that fits. Compression with Speed Up needs the Trio plan or higher, and Pagination needs Business.
To optimize images in WordPress without losing quality, resize them before upload and compress gently. Export photos at 2,000 to 2,560 px on the long edge, then use lossless or glossy compression. In a Modula gallery, start with Glossy thumbnails and a Lossless lightbox, then compare a few photos full screen.
No, Modula doesn’t convert image formats. A Modula gallery shows the format you upload, and Speed Up returns the same format, only smaller: a JPEG stays a JPEG. For WebP or AVIF, upload those files or use an optimizer plugin that creates them.
WordPress saves the sizes it generates at quality 82 for JPEG and 86 for WebP, and scales uploads over 2,560 px to a “-scaled” copy. The wp_editor_set_quality filter changes the quality, and returning false from big_image_size_threshold stops the scaling. Add them with a code snippets plugin or a child theme.
Modula’s compression stays locked for one of three reasons. The Speed Up extension is off in Modula → Extensions, your plan doesn’t include it (it starts at Trio), or the site isn’t a production site. Local and staging sites show “Not available on a local site.”



