Merge pull request #42 from wildlyinaccurate/maintain-source-interlace

Maintain source image interlace mode
This commit is contained in:
Joseph Wynn 2016-12-28 23:18:58 +13:00 committed by GitHub
commit c8eb8c0c58
4 changed files with 19 additions and 0 deletions

View File

@ -38,6 +38,18 @@ Feature: Responsive image generation
And the file "assets/resized/subdir/test-100.png" should exist
And the file "_site/assets/resized/subdir/test-100.png" should exist
Scenario: Honouring source image interlace mode
Given I have a responsive_image configuration with:
"""
template: _includes/responsive-image.html
sizes:
- width: 100
"""
And I have a file "index.html" with "{% responsive_image path: assets/progressive.jpeg %}"
When I run Jekyll
Then the image "assets/resized/progressive-100x50.jpeg" should be interlaced
Scenario: Honouring Jekyll 'source' configuration
Given I have copied my site to "my-site-copy/src"
And I have a configuration with:

View File

@ -59,6 +59,12 @@ Then /^the image "(.+)" should have the dimensions "(\d+)x(\d+)"$/ do |path, wid
img.destroy!
end
Then /^the image "(.+)" should be interlaced$/ do |path|
img = Magick::Image::read(path).first
assert_equal Magick::JPEGInterlace, img.interlace
img.destroy!
end
def write_file(path, contents)
File.open(path, 'w') do |f|
f.write(contents)

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -30,6 +30,7 @@ module Jekyll
i = img.scale(ratio)
i.write(site_source_filepath) do |f|
f.interlace = i.interlace
f.quality = size['quality'] || config['default_quality']
end