Ensure stats can be calculated for 1x1 input #2372

This commit is contained in:
Lovell Fuller
2020-09-17 11:08:52 +01:00
parent c3898487c4
commit b369c4bb8a
3 changed files with 24 additions and 6 deletions

View File

@@ -462,6 +462,19 @@ describe('Image Stats', function () {
})
);
it('Entropy and sharpness of 1x1 input are zero', async () => {
const { entropy, sharpness } = await sharp({
create: {
width: 1,
height: 1,
channels: 3,
background: 'red'
}
}).stats();
assert.strictEqual(entropy, 0);
assert.strictEqual(sharpness, 0);
});
it('Stream in, Callback out', function (done) {
const readable = fs.createReadStream(fixtures.inputJpg);
const pipeline = sharp().stats(function (err, stats) {