Skip to main content
Docs menu

filter · Image filters

Resize to rendered dimensions (resize_rendered_image_dimensions)

Category:
Image
CoreFilters:
No
OptimizeForBandwidth:
No
Risk:
Test first

resize_rendered_image_dimensions injects JavaScript that reports each image’s actual rendered dimensions on the client. On subsequent requests, mod_pagespeed resizes to the rendered size. Requires two page loads to take effect.

When to use it

  • Not in CoreFilters: it runs only when you enable it by name.
  • Risk rating on these docs: Test first.

Risks

  • resize_rendered_image_dimensions injects JavaScript and requires two page loads. The first load serves the original image.

Configuration

Enable it in the module configuration, at server, virtual-host or location scope:

Apache

ModPagespeedEnableFilters resize_rendered_image_dimensions

nginx

pagespeed EnableFilters resize_rendered_image_dimensions;

IIS (pagespeed.config)

pagespeed EnableFilters resize_rendered_image_dimensions
ParameterDefaultDescription
ImageLimitResizeAreaPercent100Only resize if the result is this percentage of the original area or less

On the worker

The worker runs its own pipeline, configured by flags. Its equivalent of this filter is the image pipeline transform. Always-on baseline under pagespeed on;; there is no per-transform off switch.

Scoping, ForbidFilters and the thresholds filters read: Choosing filters.

Live example

Resizes an image to the dimensions it is actually rendered at on the page.

In the latest measurement (November 2026), the optimized page carried only mod_pagespeed's beacon script, which reports back what a real browser rendered. This filter acts only after such a report, which the measurement does not send, so there is no source diff or measured saving to show. The live frames above load it in your browser, so they can show it.

See the before and after, with the source diff →

Frequently asked questions

What does the resize_rendered_image_dimensions filter do?
resize_rendered_image_dimensions injects JavaScript that reports each image's actual rendered dimensions on the client. On subsequent requests, mod_pagespeed resizes to the rendered size. Requires two page loads to take effect.
Is resize_rendered_image_dimensions enabled by default?
No. resize_rendered_image_dimensions is not in CoreFilters, the default RewriteLevel; it runs only when you enable it by name with EnableFilters.
How do I enable resize_rendered_image_dimensions on Apache and nginx?
Add ModPagespeedEnableFilters resize_rendered_image_dimensions on Apache or pagespeed EnableFilters resize_rendered_image_dimensions; on nginx. On IIS, add pagespeed EnableFilters resize_rendered_image_dimensions to pagespeed.config.

This page is drawn from the resize_rendered_image_dimensions entry on Image filters. Every filter in one table: PageSpeed filters.

Search