Deduplicate Inlined Images
The 'Deduplicate Inlined Images' filter is enabled by specifying:
pagespeed EnableFilters dedup_inlined_images;
in the configuration file.
Reduce the transfer size of HTML files by eliminating redundant image data URLs.
This rewriter implements the PageSpeed rule for optimizing images.
that loads the image from the first occurence of the image. If the first
image doesn't have an
id, one is generated and added to it.
dedup_inlined_images rewrites inlined images:
- If the image's data URL has not appeared earlier in the page then,
if it doesn't already have one an
idattribute is generated and added to the tag, then the existing/added
idis recorded along with the data URL for comparison with subsequent inlined images.
- Otherwise, the
<img>tag is replaced with an inline
<script>tag that replaces itself with an
<img>tag, loading the data URL from the preceding
<img>tag with the
idmatching this tag's data URL.
The effect of this filter can be observed on modpagespeed.com before and after rewriting.
The inline_images filter should be enabled for this filter to have any effect although it will apply to inlined images in the original HTML.