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_imagesandrewrite_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_subsamplingnginx
pagespeed EnableFilters jpeg_subsampling;IIS (pagespeed.config)
pagespeed EnableFilters jpeg_subsamplingIt is on by default under CoreFilters; to turn it off:
ModPagespeedDisableFilters jpeg_subsampling # Apache
pagespeed DisableFilters jpeg_subsampling; # nginx
pagespeed DisableFilters jpeg_subsampling # IISOn 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_subsamplingdownsamples 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_subsamplingis in CoreFilters, the default RewriteLevel, so it runs unless you turn it off withDisableFilters. It is also part of the OptimizeForBandwidth level. - How do I turn off jpeg_subsampling?
- Add
ModPagespeedDisableFilters jpeg_subsamplingon Apache orpagespeed DisableFilters jpeg_subsampling;on nginx. On IIS, addpagespeed DisableFilters jpeg_subsamplingto pagespeed.config.
Related filters
- strip_image_color_profile — Strip image color profiles
- strip_image_meta_data — Strip image metadata
- convert_gif_to_png — Convert GIF to PNG
- convert_jpeg_to_avif — Convert JPEG to AVIF
- convert_jpeg_to_progressive — Progressive JPEG
- convert_jpeg_to_webp — Convert JPEG to WebP
- convert_png_to_jpeg — Convert PNG to JPEG
- convert_to_avif_animated — Animated AVIF
This page is drawn from the jpeg_subsampling entry on Image filters. Every filter in one table: PageSpeed filters.