From 61f2807c9284fb8ae065cb18e006e8cc435eacab Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:00:38 -0700 Subject: [PATCH 01/15] added dominateColor definition to exports.args --- lib/defs.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/defs.js b/lib/defs.js index 47176214..af46dd7a 100644 --- a/lib/defs.js +++ b/lib/defs.js @@ -192,6 +192,10 @@ name: 'callback', type: 'function' }], + dominateColor: [{ + name: 'type', + type: 'number' + }], darken: [{ name: 'delta', type: 'number' From 3c220279d7cc5d73ce891faca1f3c73d23b5f3f9 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:01:39 -0700 Subject: [PATCH 02/15] added dominateColor --- lib/ImagePrototypeInit.js | 43 ++++++++++++++++++++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/lib/ImagePrototypeInit.js b/lib/ImagePrototypeInit.js index ef23544c..24757b34 100644 --- a/lib/ImagePrototypeInit.js +++ b/lib/ImagePrototypeInit.js @@ -35,7 +35,8 @@ toBuffer: decree(defs.args.toBuffer), writeFile: decree(defs.args.writeFile), setPixel: decree(defs.args.setPixel), - getPixel: decree(defs.args.getPixel) + getPixel: decree(defs.args.getPixel), + dominateColor: decree(defs.args.dominateColor) }; Image.prototype.__lock = function() { @@ -68,6 +69,45 @@ return this.__lwip.height(); }; + + + Image.prototype.dominateColor = function() { + var that = this, + ret_pixel; + judges.dominateColor( + arguments, + function(skips){ + if(typeof skips !== 'number' || skips < 0 || parseInt(skips,10) !== skips) + throw Error("Pass a positive integer argument for number of pixels to skip over each iteration."); + + var hash = new Map(); + + for(var i = 0; i < that.width(); i++){ + for(var j = 0; j < that.height(); j+= skips+1){ + var pixel = that.__lwip.getPixel(i,j), + key = pixel[0].toString()+','+pixel[1].toString()+','+pixel[2].toString()+','+pixel[3].toString(), + occur = hash.get(key); + if( occur === undefined) + hash.set(key,1); + else + hash.set(key,occur + 1); + } + } + + the_key = [...hash].reduce(function(prev,curr){ + return (prev[1] > curr[1])?prev:curr; + })[0].split(','); + ret_pixel = { + r: parseInt(the_key[0],10), + g: parseInt(the_key[1],10), + b: parseInt(the_key[2],10), + a: parseInt(the_key[3],10) + }; + } + ); + return ret_pixel; + }; + Image.prototype.size = function() { return { width: this.__lwip.width(), @@ -114,6 +154,7 @@ ); }; + Image.prototype.resize = function() { this.__lock(); var that = this; From 15aa1c0106f4d699586e08caa4e768039a32c1d0 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:03:36 -0700 Subject: [PATCH 03/15] added colors.jpg to exports --- tests/imgs.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/imgs.js b/tests/imgs.js index 21668a5d..1039b6df 100644 --- a/tests/imgs.js +++ b/tests/imgs.js @@ -7,7 +7,9 @@ module.exports = { gs: join(__dirname, imbase, 'gs.jpg'), rgb: join(__dirname, imbase, 'rgb.jpg'), noex: join(__dirname, imbase, 'rgbjpg'), - inv: join(__dirname, imbase, 'invalid.jpg') + inv: join(__dirname, imbase, 'invalid.jpg'), + colors: join(__dirname, imbase, 'colors.jpg') + }, png: { gs: join(__dirname, imbase, 'gs.png'), From 705a2893c931f9c3324dde0c4ca2f66768c50d65 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:04:11 -0700 Subject: [PATCH 04/15] added tests for dominateColor --- tests/01.getters/index.js | 42 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/tests/01.getters/index.js b/tests/01.getters/index.js index 1db1b414..23d11519 100644 --- a/tests/01.getters/index.js +++ b/tests/01.getters/index.js @@ -104,3 +104,45 @@ describe('lwip.getMetadata', function() { }); }); }); + +describe('lwip.getDominateColor',function(){ + var t_image; + before(function(done){ + lwip.open(imgs.jpg.colors, function(err, img) { + if (err) return done(err); + t_image = img; + console.log('see this once before'); + done(); + }); + }); + + it('should return the color that occurs the most frequently',function(done){ + var color = t_image.dominateColor(10); + assert( color.r === 255); + assert( color.g === 252); + assert( color.b === 0); + assert( color.a === 100); + done(); + }); + + function shouldFail(fail){ + it('should fail when: '+fail+' is passed as a parameter',function(done){ + var err_count = 0; + try{ + t_image.dominateColor(fail); + } + catch(error){ + err_count++; + } + finally{ + assert( err_count === 1); + } + done(); + }); + } + + var fails = [ -1, 3.3, '\'tree\'']; + for(var i = 0; i < fails.length; i++) + shouldFail(fails[i]); + +}); From bacfd40d40350caa68f1e0f514c452878d319202 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:08:10 -0700 Subject: [PATCH 05/15] used to test dominateColor --- tests/images/colors.jpg | Bin 0 -> 4844 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 tests/images/colors.jpg diff --git a/tests/images/colors.jpg b/tests/images/colors.jpg new file mode 100644 index 0000000000000000000000000000000000000000..772a62ff8c8e91d72e388c8769cb0b24d8ddfcf5 GIT binary patch literal 4844 zcmcIo2Ut_d7M>&!0)hkx9TY^Wf^?d%JJnd^dOIo-*g$f6koDx#ZX6VSv_DJD~<(P_u$r z0YL5tDmzcxl)u}yC;7X&-}J~efB^-51_T6*0l*nx2nHCr4zPc54*c4vQB*XP+bkFi zAfVrOjS5ALq#^eKS_BNh(FimEu%#_P^_aGLZaP$HQW3x=6!d(;tzAD313<6Fezm`g z=4yK&K(t;-T4bykTB-tIPoxA@Q5rMVBLJxGZ_17G`&Ui`0wBj`NAGGZLaz)d9$mjw zr@0Z(23hvQHt!ky$#_o)r0B7{78bWk21&rgqC`6o{?n^VuDR*U0{~E4dW)z@W@Ez; zj%t)XfOg8cVos>a<5MdfpOcgkt=d}RCU95NuC@Ys@4z&-Y&qLtQZ*tZ#wc&jr zv%3N&_E$V*%i}k5Tj_zeQcdG&i`isc*)?g zPq6QF7A=^IXRhFZSqsq#4#Xu?0svPUn#sC0+Y$`?QKRaBW=zZDy{n>RBmj)KsdECn z54K^Uyg)2jD|*QB9K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ZfeA&cofmuPT?F}CpnA%+rXA!uwCLOgt*__$h!5Z=YYE3ExQ_}qe#ZL-(#us>7y zuoJ5`EI(7PM@u9#w#iJMmr$C{36gSr14-w@_v4JS|l3ex%OwA31 ziUhZYYvq;AraNLMOD>Ex5qu|-0u1RFvx4eRTx+UoT6Y|FGZB8z)F%7hs@!j7rYFm) z{L((va7LyXqr?0ted=ad`o6WWVk`z8Uzc7n2yws{Ye8@-$cddI9Bl6|XtM?G+<_ug z9zp~js3?Ovhz^H3hyv}c{o?dfSDu|TN$g@#q1 zDW^VDu%9Vx0M`$hqA!HF|83hokFYWP{`&$9dn(B7TTy~eIp39T^3e9tz7iSo^J zMKK=_CLi38EbLa8CKy1_8t&J)xeeO>^J!^mEyjW#!)#|f@`^Pls<5pe6Cj%BRL2wD z#A9DN4>q|j+d@^`D%w4>$tlbk;@xHZI)%p0!m~0!pFMu_8jx3k-_AkkT)hYKmp?8| zv?Xn?T5oXDeBJ&+cG@!|Px^BLMG51RP0&h)(qM%2A1Q~@C;3i9C^=i?h4||xHx^8w z);~@p$#~E87rDGC^PcM?YQ~Ag-;Pd~>)@?)e?n(+iKOChNYqR-PKEAqBF3pk+c=@2 z^V)A*f-!t`2?|mL^jP873865oybK%1n>pQJccE$#$?oMj+z%0VAcBxm>vt}EWnq&! zQb;P#AF`}<)^RTE=fpYn=GnE}!#NE>@w#!Y)rpiKdfhw_%M~DHq{E_5Yg|?YF`(D^ J`c~xLe*sBA`Zxdp literal 0 HcmV?d00001 From b71241c790ef6bdd4a00c3c1909e8fef81a714a2 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:10:04 -0700 Subject: [PATCH 06/15] added definition for dominateColor --- README.md | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/README.md b/README.md index 890a9429..f3b98136 100644 --- a/README.md +++ b/README.md @@ -49,6 +49,7 @@ 0. [GIF](#gif) 0. [Write to file](#write-to-file) 0. [Get metadata](#get-metadata) + 0. [Get dominate color](#dominate-color) 0. [Batch operations](#batch-operations) 0. [Copyrights](#copyrights) @@ -706,6 +707,12 @@ tEXt chunks in PNG images, and will get the first tEXt chunk found with the key `image.getMetadata()` +### Get dominate color + +Get the pixel color that occurs most frequently in the picture. +`image.dominateColor(pixels_to_skip)` +0. `pixels_to_skip {Int}`: the number of pixels to skip while iterating through the image. Ex. supplying 1 will skip every other pixel, 0 will skip none. The greater the number the less accuracy the result will have. + ### Batch operations Each of the [image operations](#image-operations) above can be done as part of From 07363b29c3dd13ca6765f65984c6d0638807a2a6 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:12:26 -0700 Subject: [PATCH 07/15] added definition for dominateColor --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f3b98136..447336cb 100644 --- a/README.md +++ b/README.md @@ -707,7 +707,7 @@ tEXt chunks in PNG images, and will get the first tEXt chunk found with the key `image.getMetadata()` -### Get dominate color +#### Get dominate color Get the pixel color that occurs most frequently in the picture. `image.dominateColor(pixels_to_skip)` From e2d92fc2be90c998a442bcbf9c2151ee98cb064e Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:30:03 -0700 Subject: [PATCH 08/15] fixed dominateColor link --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 447336cb..f0601f5d 100644 --- a/README.md +++ b/README.md @@ -707,10 +707,12 @@ tEXt chunks in PNG images, and will get the first tEXt chunk found with the key `image.getMetadata()` -#### Get dominate color +### Get dominate color + +Get the pixel color that occurs most frequently in a picture. -Get the pixel color that occurs most frequently in the picture. `image.dominateColor(pixels_to_skip)` + 0. `pixels_to_skip {Int}`: the number of pixels to skip while iterating through the image. Ex. supplying 1 will skip every other pixel, 0 will skip none. The greater the number the less accuracy the result will have. ### Batch operations From c070a6753ae7b3a942338843076145b0304ea89a Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:31:07 -0700 Subject: [PATCH 09/15] fixed dominateColor link --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index f0601f5d..345f1c96 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ 0. [GIF](#gif) 0. [Write to file](#write-to-file) 0. [Get metadata](#get-metadata) - 0. [Get dominate color](#dominate-color) + 0. [Get dominate color](#get-dominate-color) 0. [Batch operations](#batch-operations) 0. [Copyrights](#copyrights) From 4bab7c575f0f20474b6e179f712f7c1dc2f829c8 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 12:52:19 -0700 Subject: [PATCH 10/15] removed log --- tests/01.getters/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/01.getters/index.js b/tests/01.getters/index.js index 23d11519..a449d4a3 100644 --- a/tests/01.getters/index.js +++ b/tests/01.getters/index.js @@ -111,7 +111,6 @@ describe('lwip.getDominateColor',function(){ lwip.open(imgs.jpg.colors, function(err, img) { if (err) return done(err); t_image = img; - console.log('see this once before'); done(); }); }); From 55fdda7f090dace865eb9ca87ea8181f46aab17c Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Fri, 10 Jun 2016 13:12:18 -0700 Subject: [PATCH 11/15] adjusted name --- tests/01.getters/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/01.getters/index.js b/tests/01.getters/index.js index a449d4a3..a454a0b4 100644 --- a/tests/01.getters/index.js +++ b/tests/01.getters/index.js @@ -105,7 +105,7 @@ describe('lwip.getMetadata', function() { }); }); -describe('lwip.getDominateColor',function(){ +describe('lwip.dominateColor',function(){ var t_image; before(function(done){ lwip.open(imgs.jpg.colors, function(err, img) { From ecc39bb45059c022c109c601752a1c2e179728d3 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Thu, 16 Jun 2016 09:41:56 -0700 Subject: [PATCH 12/15] replaced ES6 code with ES5 --- lib/ImagePrototypeInit.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/lib/ImagePrototypeInit.js b/lib/ImagePrototypeInit.js index 24757b34..286fd1fd 100644 --- a/lib/ImagePrototypeInit.js +++ b/lib/ImagePrototypeInit.js @@ -81,7 +81,7 @@ throw Error("Pass a positive integer argument for number of pixels to skip over each iteration."); var hash = new Map(); - + for(var i = 0; i < that.width(); i++){ for(var j = 0; j < that.height(); j+= skips+1){ var pixel = that.__lwip.getPixel(i,j), @@ -94,9 +94,15 @@ } } - the_key = [...hash].reduce(function(prev,curr){ - return (prev[1] > curr[1])?prev:curr; - })[0].split(','); + var the_key = '0,0,0,0', count = 0; + hash.forEach(function(val,key){ + if(val > count){ + the_key = key; + count = val; + } + }); + the_key = the_key.split(','); + ret_pixel = { r: parseInt(the_key[0],10), g: parseInt(the_key[1],10), From 6d781516f81af2a54dc855321f344da0fa786943 Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Thu, 16 Jun 2016 10:38:03 -0700 Subject: [PATCH 13/15] replaced ES6 code with ES5 --- lib/ImagePrototypeInit.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/ImagePrototypeInit.js b/lib/ImagePrototypeInit.js index 286fd1fd..b5b2472d 100644 --- a/lib/ImagePrototypeInit.js +++ b/lib/ImagePrototypeInit.js @@ -80,27 +80,27 @@ if(typeof skips !== 'number' || skips < 0 || parseInt(skips,10) !== skips) throw Error("Pass a positive integer argument for number of pixels to skip over each iteration."); - var hash = new Map(); + var hash = {}; for(var i = 0; i < that.width(); i++){ for(var j = 0; j < that.height(); j+= skips+1){ var pixel = that.__lwip.getPixel(i,j), key = pixel[0].toString()+','+pixel[1].toString()+','+pixel[2].toString()+','+pixel[3].toString(), - occur = hash.get(key); + occur = hash[key]; if( occur === undefined) - hash.set(key,1); + hash[key] = 1; else - hash.set(key,occur + 1); + hash[key]++; } } var the_key = '0,0,0,0', count = 0; - hash.forEach(function(val,key){ - if(val > count){ + for(var key in hash){ + if(hash[key] > count){ the_key = key; - count = val; + count = hash[key]; } - }); + } the_key = the_key.split(','); ret_pixel = { From bee413e9efdb3810d9626d446cf965fb6256f72b Mon Sep 17 00:00:00 2001 From: MarkOtten Date: Wed, 6 Jul 2016 18:41:38 -0700 Subject: [PATCH 14/15] renamed dominateColor to dominantColor --- lib/BatchPrototypeInit.js | 1 + lib/ImagePrototypeInit.js | 6 +++--- lib/defs.js | 2 +- tests/.DS_Store | Bin 6148 -> 8196 bytes tests/01.getters/index.js | 6 +++--- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/BatchPrototypeInit.js b/lib/BatchPrototypeInit.js index 75ee6c49..f0465009 100644 --- a/lib/BatchPrototypeInit.js +++ b/lib/BatchPrototypeInit.js @@ -37,6 +37,7 @@ exec: decree(defs.args.exec), toBuffer: decree(defs.args.toBuffer), writeFile: decree(defs.args.writeFile) + }; var undefinedFilter = util.undefinedFilter, diff --git a/lib/ImagePrototypeInit.js b/lib/ImagePrototypeInit.js index b5b2472d..f359fc79 100644 --- a/lib/ImagePrototypeInit.js +++ b/lib/ImagePrototypeInit.js @@ -36,7 +36,7 @@ writeFile: decree(defs.args.writeFile), setPixel: decree(defs.args.setPixel), getPixel: decree(defs.args.getPixel), - dominateColor: decree(defs.args.dominateColor) + dominantColor: decree(defs.args.dominantColor) }; Image.prototype.__lock = function() { @@ -71,10 +71,10 @@ - Image.prototype.dominateColor = function() { + Image.prototype.dominantColor = function() { var that = this, ret_pixel; - judges.dominateColor( + judges.dominantColor( arguments, function(skips){ if(typeof skips !== 'number' || skips < 0 || parseInt(skips,10) !== skips) diff --git a/lib/defs.js b/lib/defs.js index af46dd7a..4698afa7 100644 --- a/lib/defs.js +++ b/lib/defs.js @@ -192,7 +192,7 @@ name: 'callback', type: 'function' }], - dominateColor: [{ + dominantColor: [{ name: 'type', type: 'number' }], diff --git a/tests/.DS_Store b/tests/.DS_Store index 51cf4899f88f09720a14b37382d8fabd0271397c..511c388c1887d84899dd809f6268c79b6abd4a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xSf263 Date: Wed, 6 Jul 2016 18:46:27 -0700 Subject: [PATCH 15/15] renamed dominateColor to dominantColor --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 345f1c96..e32e834e 100644 --- a/README.md +++ b/README.md @@ -49,7 +49,7 @@ 0. [GIF](#gif) 0. [Write to file](#write-to-file) 0. [Get metadata](#get-metadata) - 0. [Get dominate color](#get-dominate-color) + 0. [Get dominant color](#get-dominant-color) 0. [Batch operations](#batch-operations) 0. [Copyrights](#copyrights) @@ -707,11 +707,11 @@ tEXt chunks in PNG images, and will get the first tEXt chunk found with the key `image.getMetadata()` -### Get dominate color +### Get dominant color Get the pixel color that occurs most frequently in a picture. -`image.dominateColor(pixels_to_skip)` +`image.dominantColor(pixels_to_skip)` 0. `pixels_to_skip {Int}`: the number of pixels to skip while iterating through the image. Ex. supplying 1 will skip every other pixel, 0 will skip none. The greater the number the less accuracy the result will have.