From 826b5f715e96f11d4ba5c64d29af864148e4e34d Mon Sep 17 00:00:00 2001 From: Bert Driehuis Date: Fri, 19 Jan 2018 01:08:35 +0100 Subject: [PATCH] Add option to strip EXIF profiles --- README.md | 5 +++++ lib/jekyll-responsive-image/config.rb | 3 ++- lib/jekyll-responsive-image/resize_handler.rb | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 07cc999..0741736 100644 --- a/README.md +++ b/README.md @@ -52,6 +52,11 @@ responsive_image: # working with JPGs directly from digital cameras and smartphones auto_rotate: false + # [Optional, Default: false] + # Strip EXIF and other JPEG profiles. Helps to minimize JPEG size and win friends + # at Google PageSpeed. + strip: false + # [Optional, Default: assets] # The base directory where assets are stored. This is used to determine the # `dirname` value in `output_path_format` below. diff --git a/lib/jekyll-responsive-image/config.rb b/lib/jekyll-responsive-image/config.rb index 7d4f368..3880abd 100644 --- a/lib/jekyll-responsive-image/config.rb +++ b/lib/jekyll-responsive-image/config.rb @@ -9,7 +9,8 @@ module Jekyll 'extra_images' => [], 'auto_rotate' => false, 'save_to_source' => true, - 'cache' => false + 'cache' => false, + 'strip' => false } def initialize(site) diff --git a/lib/jekyll-responsive-image/resize_handler.rb b/lib/jekyll-responsive-image/resize_handler.rb index bc86b68..9f9f5bc 100644 --- a/lib/jekyll-responsive-image/resize_handler.rb +++ b/lib/jekyll-responsive-image/resize_handler.rb @@ -36,6 +36,9 @@ module Jekyll Jekyll.logger.info "Generating #{target_filepath}" + if config['strip'] + img.strip! + end i = img.scale(ratio) i.write(target_filepath) do |f| f.interlace = i.interlace