mirror of
https://github.com/lovell/sharp.git
synced 2026-02-09 08:06:14 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c210ac73cc | ||
|
|
962c91daf0 | ||
|
|
df33c3024a | ||
|
|
62e04f7784 | ||
|
|
32fcb771ca |
@@ -2,6 +2,12 @@
|
|||||||
|
|
||||||
### v0.13 - "*mind*"
|
### v0.13 - "*mind*"
|
||||||
|
|
||||||
|
#### v0.13.1 - 27<sup>th</sup> February 2016
|
||||||
|
|
||||||
|
* Fix embedding onto transparent backgrounds; regression introduced in v0.13.0.
|
||||||
|
[#366](https://github.com/lovell/sharp/issues/366)
|
||||||
|
[@diegocsandrim](https://github.com/diegocsandrim)
|
||||||
|
|
||||||
#### v0.13.0 - 15<sup>th</sup> February 2016
|
#### v0.13.0 - 15<sup>th</sup> February 2016
|
||||||
|
|
||||||
* Improve vector image support by allowing control of density/DPI.
|
* Improve vector image support by allowing control of density/DPI.
|
||||||
|
|||||||
1
index.js
1
index.js
@@ -884,7 +884,6 @@ Sharp.prototype.clone = function() {
|
|||||||
// Clone existing options
|
// Clone existing options
|
||||||
var clone = new Sharp();
|
var clone = new Sharp();
|
||||||
util._extend(clone.options, this.options);
|
util._extend(clone.options, this.options);
|
||||||
clone.streamIn = false;
|
|
||||||
// Pass 'finish' event to clone for Stream-based input
|
// Pass 'finish' event to clone for Stream-based input
|
||||||
this.on('finish', function() {
|
this.on('finish', function() {
|
||||||
// Clone inherits input data
|
// Clone inherits input data
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sharp",
|
"name": "sharp",
|
||||||
"version": "0.13.0",
|
"version": "0.13.1",
|
||||||
"author": "Lovell Fuller <npm@lovell.info>",
|
"author": "Lovell Fuller <npm@lovell.info>",
|
||||||
"contributors": [
|
"contributors": [
|
||||||
"Pierre Inglebert <pierre.inglebert@gmail.com>",
|
"Pierre Inglebert <pierre.inglebert@gmail.com>",
|
||||||
@@ -47,7 +47,7 @@
|
|||||||
"vips"
|
"vips"
|
||||||
],
|
],
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"bluebird": "^3.2.2",
|
"bluebird": "^3.3.3",
|
||||||
"color": "^0.11.1",
|
"color": "^0.11.1",
|
||||||
"nan": "^2.2.0",
|
"nan": "^2.2.0",
|
||||||
"semver": "^5.1.0",
|
"semver": "^5.1.0",
|
||||||
@@ -56,14 +56,14 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"async": "^1.5.2",
|
"async": "^1.5.2",
|
||||||
"coveralls": "^2.11.6",
|
"coveralls": "^2.11.8",
|
||||||
"exif-reader": "^1.0.0",
|
"exif-reader": "^1.0.0",
|
||||||
"icc": "^0.0.2",
|
"icc": "^0.0.2",
|
||||||
"istanbul": "^0.4.2",
|
"istanbul": "^0.4.2",
|
||||||
"mocha": "^2.4.5",
|
"mocha": "^2.4.5",
|
||||||
"mocha-jshint": "^2.3.1",
|
"mocha-jshint": "^2.3.1",
|
||||||
"node-cpplint": "^0.4.0",
|
"node-cpplint": "^0.4.0",
|
||||||
"rimraf": "^2.5.1",
|
"rimraf": "^2.5.2",
|
||||||
"bufferutil": "^1.2.1"
|
"bufferutil": "^1.2.1"
|
||||||
},
|
},
|
||||||
"license": "Apache-2.0",
|
"license": "Apache-2.0",
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
# Install Node.js on openSUSE 13.2
|
# Install Node.js on openSUSE 13.2
|
||||||
zypper addrepo http://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_13.2/devel:languages:nodejs.repo
|
zypper addrepo http://download.opensuse.org/repositories/devel:languages:nodejs/openSUSE_13.2/devel:languages:nodejs.repo
|
||||||
zypper --gpg-auto-import-keys refresh
|
zypper --gpg-auto-import-keys refresh
|
||||||
zypper --non-interactive install gcc-c++ make nodejs-devel nodejs-npm
|
zypper --non-interactive install gcc-c++ make nodejs-devel npm
|
||||||
npm install -g npm
|
npm install -g npm
|
||||||
|
|||||||
@@ -585,9 +585,9 @@ class PipelineWorker : public AsyncWorker {
|
|||||||
}
|
}
|
||||||
// Add non-transparent alpha channel, if required
|
// Add non-transparent alpha channel, if required
|
||||||
if (baton->background[3] < 255.0 && !HasAlpha(image)) {
|
if (baton->background[3] < 255.0 && !HasAlpha(image)) {
|
||||||
VImage alpha = VImage::new_matrix(image.width(), image.height())
|
image = image.bandjoin(
|
||||||
.new_from_image(baton->background[3] * multiplier);
|
VImage::new_matrix(image.width(), image.height()).new_from_image(255 * multiplier)
|
||||||
image = image.bandjoin(alpha);
|
);
|
||||||
}
|
}
|
||||||
// Embed
|
// Embed
|
||||||
int left = static_cast<int>(round((baton->width - image.width()) / 2));
|
int left = static_cast<int>(round((baton->width - image.width()) / 2));
|
||||||
|
|||||||
BIN
test/fixtures/expected/embed-3-into-3.png
vendored
Normal file
BIN
test/fixtures/expected/embed-3-into-3.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 116 KiB |
BIN
test/fixtures/expected/embed-3-into-4.webp
vendored
Normal file
BIN
test/fixtures/expected/embed-3-into-4.webp
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 10 KiB |
BIN
test/fixtures/expected/embed-4-into-4.png
vendored
Normal file
BIN
test/fixtures/expected/embed-4-into-4.png
vendored
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 670 B |
@@ -60,14 +60,11 @@ describe('Alpha transparency', function() {
|
|||||||
it('Do not flatten', function(done) {
|
it('Do not flatten', function(done) {
|
||||||
sharp(fixtures.inputPngWithTransparency)
|
sharp(fixtures.inputPngWithTransparency)
|
||||||
.flatten(false)
|
.flatten(false)
|
||||||
.toBuffer(function(err, data) {
|
.toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
sharp(data).metadata(function(err, metadata) {
|
assert.strictEqual('png', info.format);
|
||||||
if (err) throw err;
|
assert.strictEqual(4, info.channels);
|
||||||
assert.strictEqual('png', metadata.format);
|
done();
|
||||||
assert.strictEqual(4, metadata.channels);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -75,14 +72,11 @@ describe('Alpha transparency', function() {
|
|||||||
sharp(fixtures.inputJpg)
|
sharp(fixtures.inputJpg)
|
||||||
.background('#ff0000')
|
.background('#ff0000')
|
||||||
.flatten()
|
.flatten()
|
||||||
.toBuffer(function(err, data) {
|
.toBuffer(function(err, data, info) {
|
||||||
if (err) throw err;
|
if (err) throw err;
|
||||||
sharp(data).metadata(function(err, metadata) {
|
assert.strictEqual('jpeg', info.format);
|
||||||
if (err) throw err;
|
assert.strictEqual(3, info.channels);
|
||||||
assert.strictEqual('jpeg', metadata.format);
|
done();
|
||||||
assert.strictEqual(3, metadata.channels);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -18,11 +18,8 @@ describe('Embed', function() {
|
|||||||
assert.strictEqual('png', info.format);
|
assert.strictEqual('png', info.format);
|
||||||
assert.strictEqual(320, info.width);
|
assert.strictEqual(320, info.width);
|
||||||
assert.strictEqual(240, info.height);
|
assert.strictEqual(240, info.height);
|
||||||
sharp(data).metadata(function(err, metadata) {
|
assert.strictEqual(3, info.channels);
|
||||||
if (err) throw err;
|
fixtures.assertSimilar(fixtures.expected('embed-3-into-3.png'), data, done);
|
||||||
assert.strictEqual(3, metadata.channels);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -39,11 +36,8 @@ describe('Embed', function() {
|
|||||||
assert.strictEqual('webp', info.format);
|
assert.strictEqual('webp', info.format);
|
||||||
assert.strictEqual(320, info.width);
|
assert.strictEqual(320, info.width);
|
||||||
assert.strictEqual(240, info.height);
|
assert.strictEqual(240, info.height);
|
||||||
sharp(data).metadata(function(err, metadata) {
|
assert.strictEqual(4, info.channels);
|
||||||
if (err) throw err;
|
fixtures.assertSimilar(fixtures.expected('embed-3-into-4.webp'), data, done);
|
||||||
assert.strictEqual(4, metadata.channels);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -58,11 +52,8 @@ describe('Embed', function() {
|
|||||||
assert.strictEqual('png', info.format);
|
assert.strictEqual('png', info.format);
|
||||||
assert.strictEqual(50, info.width);
|
assert.strictEqual(50, info.width);
|
||||||
assert.strictEqual(50, info.height);
|
assert.strictEqual(50, info.height);
|
||||||
sharp(data).metadata(function(err, metadata) {
|
assert.strictEqual(4, info.channels);
|
||||||
if (err) throw err;
|
fixtures.assertSimilar(fixtures.expected('embed-4-into-4.png'), data, done);
|
||||||
assert.strictEqual(4, metadata.channels);
|
|
||||||
done();
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -76,6 +67,7 @@ describe('Embed', function() {
|
|||||||
assert.strictEqual('png', info.format);
|
assert.strictEqual('png', info.format);
|
||||||
assert.strictEqual(32, info.width);
|
assert.strictEqual(32, info.width);
|
||||||
assert.strictEqual(16, info.height);
|
assert.strictEqual(16, info.height);
|
||||||
|
assert.strictEqual(4, info.channels);
|
||||||
fixtures.assertSimilar(fixtures.expected('embed-16bit.png'), data, done);
|
fixtures.assertSimilar(fixtures.expected('embed-16bit.png'), data, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -91,6 +83,7 @@ describe('Embed', function() {
|
|||||||
assert.strictEqual('png', info.format);
|
assert.strictEqual('png', info.format);
|
||||||
assert.strictEqual(32, info.width);
|
assert.strictEqual(32, info.width);
|
||||||
assert.strictEqual(16, info.height);
|
assert.strictEqual(16, info.height);
|
||||||
|
assert.strictEqual(4, info.channels);
|
||||||
fixtures.assertSimilar(fixtures.expected('embed-16bit-rgba.png'), data, done);
|
fixtures.assertSimilar(fixtures.expected('embed-16bit-rgba.png'), data, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -105,6 +98,7 @@ describe('Embed', function() {
|
|||||||
assert.strictEqual('png', info.format);
|
assert.strictEqual('png', info.format);
|
||||||
assert.strictEqual(320, info.width);
|
assert.strictEqual(320, info.width);
|
||||||
assert.strictEqual(240, info.height);
|
assert.strictEqual(240, info.height);
|
||||||
|
assert.strictEqual(3, info.channels);
|
||||||
fixtures.assertSimilar(fixtures.expected('embed-enlarge.png'), data, done);
|
fixtures.assertSimilar(fixtures.expected('embed-enlarge.png'), data, done);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user