gulp-image-resize
Advanced tools
Comparing version 0.10.0 to 0.11.0
@@ -142,2 +142,17 @@ var gulp = require("gulp"); | ||
resize([ | ||
"test/fixtures/Rhododendron.jpg", | ||
"test/fixtures/wikipedia.png" | ||
], "interlace", { | ||
interlace: true | ||
}); | ||
resize([ | ||
"test/fixtures/Rhododendron.jpg", | ||
"test/fixtures/wikipedia.png" | ||
], "interlace_and_resize", { | ||
width: 400, | ||
interlace: true | ||
}); | ||
gulp.task("image_resize", resizeTasks); | ||
@@ -144,0 +159,0 @@ |
16
index.js
@@ -25,3 +25,4 @@ /* | ||
format : null, | ||
flatten : false | ||
flatten : false, | ||
interlace : false | ||
}); | ||
@@ -49,5 +50,8 @@ | ||
if(!options.upscale){ | ||
// Math.min(undefined, 5) will return NaN, so it can stay undefined | ||
options.width = Math.min(options.width, size.width); | ||
options.height = Math.min(options.height, size.height); | ||
if (!isNaN(options.width)) { | ||
options.width = Math.min(options.width, size.width); | ||
} | ||
if (!isNaN(options.height)) { | ||
options.height = Math.min(options.height, size.height); | ||
} | ||
} | ||
@@ -107,2 +111,6 @@ | ||
if (options.interlace) { | ||
gmfile = gmfile.interlace('Line'); | ||
} | ||
if (options.background) { | ||
@@ -109,0 +117,0 @@ gmfile = gmfile.background(options.background); |
{ | ||
"name": "gulp-image-resize", | ||
"description": "Resizing images made easy.", | ||
"version": "0.10.0", | ||
"version": "0.11.0", | ||
"homepage": "https://github.com/scalableminds/gulp-image-resize", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -150,2 +150,11 @@ # [gulp](https://github.com/wearefractal/gulp)-image-resize [![Build Status](https://drone.io/github.com/scalableminds/gulp-image-resize/status.png)](https://drone.io/github.com/scalableminds/gulp-image-resize/latest) | ||
#### options.interlace | ||
Type: `Boolean` | ||
Default value: `false` | ||
Set to `true` to create interlaced images (scanline interlacing) from PNG, GIF or JPEG files | ||
(also known as "progressive" JPEG). For details look for parameter _-interlace <type>_ with the type value set to | ||
"Line" in the [gm profile documentation](http://www.graphicsmagick.org/GraphicsMagick.html#details-interlace). | ||
#### options.imageMagick | ||
@@ -152,0 +161,0 @@ |
@@ -180,1 +180,8 @@ /*global describe, it, before, beforeEach, after, afterEach */ | ||
}); | ||
describe("interlace", function () { | ||
it("should interlace Rhododendron.jpg", createTests("interlace", "Rhododendron.jpg")); | ||
it("should interlace wikipedia.png", createTests("interlace", "wikipedia.png")); | ||
it("should interlace plus resize Rhododendron.jpg", createTests("interlace_and_resize", "Rhododendron.jpg")); | ||
it("should interlace plus resize wikipedia.png", createTests("interlace_and_resize", "wikipedia.png")); | ||
}); |
2342454
34
386
253