Skip to main content

filter · Image filters

JPEG chroma subsampling (jpeg_subsampling)

Category:
Image
CoreFilters:
Yes
OptimizeForBandwidth:
Yes
Risk:
Generally safe

jpeg_subsampling downsamples JPEG chroma channels (4:2:0 subsampling), reducing file size with minimal visual impact on photographic content.

When to use it

  • In CoreFilters, the default RewriteLevel: it runs unless you disable it.
  • Part of OptimizeForBandwidth, the level that optimizes resources without changing their URLs.
  • Also switched on by recompress_images and rewrite_images.
  • Risk rating on these docs: Generally safe.

Risks

  • Stripping color profiles can cause subtle color shifts on wide-gamut displays or for images authored in non-sRGB color spaces. This affects a small fraction of web images.

  • Stripping metadata removes copyright and attribution information embedded in the file. The metadata is removed from the served variant only; original files on disk are not modified.

Configuration

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

Apache

ModPagespeedEnableFilters jpeg_subsampling

nginx

pagespeed EnableFilters jpeg_subsampling;

IIS (pagespeed.config)

pagespeed EnableFilters jpeg_subsampling

It is on by default under CoreFilters; to turn it off:

ModPagespeedDisableFilters jpeg_subsampling   # Apache
pagespeed DisableFilters jpeg_subsampling;   # nginx
pagespeed DisableFilters jpeg_subsampling   # IIS

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 .

Frequently asked questions

What does the jpeg_subsampling filter do?
jpeg_subsampling downsamples JPEG chroma channels (4:2:0 subsampling), reducing file size with minimal visual impact on photographic content.
Is jpeg_subsampling enabled by default?
Yes. jpeg_subsampling is in CoreFilters, the default RewriteLevel, so it runs unless you turn it off with DisableFilters. It is also part of the OptimizeForBandwidth level.
How do I turn off jpeg_subsampling?
Add ModPagespeedDisableFilters jpeg_subsampling on Apache or pagespeed DisableFilters jpeg_subsampling; on nginx. On IIS, add pagespeed DisableFilters jpeg_subsampling to pagespeed.config.

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

Search