From b30b48785f07bb76fa0136b2ced5751db7d7d769 Mon Sep 17 00:00:00 2001 From: GabiThume Date: Tue, 6 Sep 2016 17:43:28 -0300 Subject: [PATCH 1/2] Use jpegStream instead of pngStream --- components/GetSaliency-node.coffee | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/GetSaliency-node.coffee b/components/GetSaliency-node.coffee index b31f83e..0eaa4a1 100644 --- a/components/GetSaliency-node.coffee +++ b/components/GetSaliency-node.coffee @@ -10,7 +10,8 @@ exec = require('child_process').exec writeCanvasTempFile = (canvas, callback) -> tmpFile = new temporary.File - rs = canvas.pngStream() + rs = canvas.jpegStream + quality: 100 ws = fs.createWriteStream tmpFile.path rs.once 'error', (error) -> From 8c2a19604017ccd3bee5c25cd43c76f196e7a68d Mon Sep 17 00:00:00 2001 From: GabiThume Date: Tue, 6 Sep 2016 17:43:44 -0300 Subject: [PATCH 2/2] Adjust test expectation --- spec/GetSaliency.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spec/GetSaliency.coffee b/spec/GetSaliency.coffee index 1de013e..0035e86 100644 --- a/spec/GetSaliency.coffee +++ b/spec/GetSaliency.coffee @@ -91,7 +91,7 @@ describe 'GetSaliency component', -> chai.expect(regions[0].polygon[0].x).to.be.a 'number' chai.expect(regions[0].polygon[0].y).to.be.a 'number' - expected = [[60, 1], [511, 511]] + expected = [[61, 1], [511, 511]] chai.expect(bounding_rect).to.be.deep.equal expected chai.expect(polygon).to.be.an 'array' chai.expect(polygon.length).to.be.gt 0 @@ -99,9 +99,9 @@ describe 'GetSaliency component', -> expected = [285, 255] chai.expect(center).to.be.deep.equal expected expected = - x: 60 + x: 61 y: 1 - width: 451 + width: 450 height: 510 chai.expect(bbox).to.be.deep.equal expected chai.expect(confidence).to.be.lte 0.30