{"_id":"colour-extractor","_rev":"13-9a445069886e746f97ac70e87e0f84f1","name":"colour-extractor","description":"Extract colour palettes from images","dist-tags":{"latest":"0.2.1"},"versions":{"0.1.0":{"name":"colour-extractor","description":"Extract colour palettes from images","version":"0.1.0","homepage":"http://github.com/josip/node-colour-extractor","repository":{"type":"git","url":"git://github.com/josip/node-colour-extractor.git"},"author":{"name":"Josip Lisec","email":"josip@jlx.cc","url":"http://jlx.cc"},"main":"lib/colour-extractor.js","directories":{"lib":"lib"},"engines":{"node":"0.4.x"},"dependencies":{"gm":">=0.4.0"},"_id":"colour-extractor@0.1.0","_engineSupported":true,"_npmVersion":"0.3.15","_nodeVersion":"v0.4.2","files":[""],"_defaultsLoaded":true,"dist":{"shasum":"a38bb885b68704cb52f7d011eeeba71f33651752","tarball":"https://registry.npmjs.org/colour-extractor/-/colour-extractor-0.1.0.tgz","integrity":"sha512-YO1MontHFMJYsrEDBL8xLyHhJNaowApYZm6Xr7N5bNDgHfFWmIYquY34IkPhjcxuNvPfowL5xL70KPzkHLFRLw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCICI9fIShWlN1pUqXxBnfIGwYa5OrYfLYkxymxjoPnswtAiAfq+PNtYvBeJvBuUkrneMZyBAl4B9NlCAPJqbY1Ijopg=="}]},"deprecated":"Package no longer supported. Upgrade to @colour-extractor/colour-extractor."},"0.2.0":{"name":"colour-extractor","description":"Extract colour palettes from images","version":"0.2.0","homepage":"http://github.com/josip/node-colour-extractor","repository":{"type":"git","url":"git://github.com/josip/node-colour-extractor.git"},"author":{"name":"Josip Lisec","email":"josip@jlx.cc","url":"http://jlx.cc"},"main":"lib/colour-extractor.js","directories":{"lib":"lib"},"engines":{"node":">=0.4"},"dependencies":{"gm":">=0.4.0","temp":">=0.4.x"},"readme":"# colour-extractor\n\nExtract colour palettes from photos using Node.js.\n\n## Installation\n\nIs as simple as with any other Node.js module:\n\n    $ npm install colour-extractor\n\nNOTE: `colour-extractor` depends on [gm](http://aheckmann.github.com/gm/) module, which in turn depends on [GraphicsMagick](http://www.graphicsmagick.org).\n\n## Usage\n\n`colour-extractor` exports two functions:\n\n    ce = require('colour-extractor')\n    ce.topColours('Photos/Cats/01.jpg', true, function (colours) {\n      console.log(colours);\n    });\n\n`topColours` function takes three arguments:\n\n  * path to your photo,\n  * `true` if you'd like the resulting array to be sorted by frequency,\n    `false` if you'd like to get colours sorted as they appear in the photo (top-to-bottom),\n  * a callback function.\n\nCallback function will be passed an `Array` with RGB triplet of each colour and its frequency:\n\n    [\n      [1,   [46, 70, 118]],\n      [0.3, [0,   0,   2]],\n      [0.2, [12,  44,  11]]\n    ]\n\nThe second function, `colourKey`, returns an array with nine colours, where each one can be mapped to a 3x3 box, ie. super-pixelised representation of the photo.\n\n    ce.colourKey('Photos/Cats/999999.jpg', function (colours) {\n      database.store('colour-keys', photoId, colours);\n      res.send(colours);\n      // render colours to user while they wait for the photo to load.\n      // (or something equally brilliant)\n    });\n\n\n### Utilities\n\n`colour-extractor` exports two more utility functions:\n\n    > ce.rgb2hex(100, 10, 12);\n    '#640a0c'\n    > ce.rgb2hex([44, 44, 44]);\n    '#2c2c2c'\n    > ce.hex2rgb('#ffffff');\n    [255, 255, 255]\n    > ce.hex2rgb('45c092')\n    [69, 192, 146]\n\n## How does it work?\n\nThat's what I'd like to know as well! Anyhow, `colour-extractor` parses GraphicMagick's histogram, tries to detect similar colours and remove ones which appear less frequently than others.\n\nIf you happen to know an actual algorithm that deals with this sort of stuff, don't hesitate to contact me!\n\n## Licence\n\nCopyright (C) 2011 by Josip Lisec <Josip Of JLX.cc>\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\n  * The above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\n  * The Software shall not be used in preparation, baking and consumption of chocolate cupcakes.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\n","readmeFilename":"README.md","_id":"colour-extractor@0.2.0","dist":{"shasum":"351079c46f5330c20af665c463b5f17f1aacad43","tarball":"https://registry.npmjs.org/colour-extractor/-/colour-extractor-0.2.0.tgz","integrity":"sha512-U+7c9i8MYYIng5eg3L4/VfKbiMNEu55cSmgP22REB80GPFf0wuZ60crtX9XskwkQFX4K6jFRTYeAjF4Fc2JWgA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGmxhtsxoq7zVBl7G8kga2BImwxU6faEiU8YTZTsoxv+AiAHZZYF7SK+L2jVYShpK347uPmFhMuaNDHJ/qa0JEufKQ=="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"josip","email":"josip@jlx.cc"},"maintainers":[{"name":"josip","email":"josip@jlx.cc"}],"deprecated":"Package no longer supported. Upgrade to @colour-extractor/colour-extractor."},"0.2.1":{"name":"colour-extractor","description":"Extract colour palettes from images","version":"0.2.1","homepage":"http://github.com/josip/node-colour-extractor","repository":{"type":"git","url":"git://github.com/josip/node-colour-extractor.git"},"author":{"name":"Josip Lisec","email":"josip@jlx.cc","url":"http://jlx.cc"},"main":"lib/colour-extractor.js","directories":{"lib":"lib"},"engines":{"node":">=0.4"},"dependencies":{"gm":">=0.4.0","temp":">=0.4.x"},"readme":"[![build status](https://secure.travis-ci.org/josip/node-colour-extractor.png)](http://travis-ci.org/josip/node-colour-extractor)\n# colour-extractor\n\nExtract colour palettes from photos using Node.js.\n\n## Installation\n\nIs as simple as with any other Node.js module:\n\n    $ npm install colour-extractor\n\nNOTE: `colour-extractor` depends on [gm](http://aheckmann.github.com/gm/) module, which in turn depends on [GraphicsMagick](http://www.graphicsmagick.org).\n\n## Sample\n![sample](http://i.imgur.com/8aWnu5W.png)\n\n## Usage\n\n`colour-extractor` exports two functions:\n\n    ce = require('colour-extractor')\n    ce.topColours('Photos/Cats/01.jpg', true, function (colours) {\n      console.log(colours);\n    });\n\n`topColours` function takes three arguments:\n\n  * path to your photo,\n  * `true` if you'd like the resulting array to be sorted by frequency,\n    `false` if you'd like to get colours sorted as they appear in the photo (top-to-bottom),\n  * a callback function.\n\nCallback function will be passed an `Array` with RGB triplet of each colour and its frequency:\n\n    [\n      [1,   [46, 70, 118]],\n      [0.3, [0,   0,   2]],\n      [0.2, [12,  44,  11]]\n    ]\n\nThe second function, `colourKey`, returns an array with nine colours, where each one can be mapped to a 3x3 box, ie. super-pixelised representation of the photo.\n\n    ce.colourKey('Photos/Cats/999999.jpg', function (colours) {\n      database.store('colour-keys', photoId, colours);\n      res.send(colours);\n      // render colours to user while they wait for the photo to load.\n      // (or something equally brilliant)\n    });\n\n\n### Utilities\n\n`colour-extractor` exports two more utility functions:\n\n    > ce.rgb2hex(100, 10, 12);\n    '#640a0c'\n    > ce.rgb2hex([44, 44, 44]);\n    '#2c2c2c'\n    > ce.hex2rgb('#ffffff');\n    [255, 255, 255]\n    > ce.hex2rgb('45c092')\n    [69, 192, 146]\n\n## How does it work?\n\nThat's what I'd like to know as well! Anyhow, `colour-extractor` parses GraphicMagick's histogram, tries to detect similar colours and remove ones which appear less frequently than others.\n\nIf you happen to know an actual algorithm that deals with this sort of stuff, don't hesitate to contact me!\n\n## License\n\ncolour-extractor is published under MMIT license, please see the LICENSE file for full details.\n\nPhotos used in the sample can be downloaded from Flickr:\n\n  * [Title?](http://www.flickr.com/photos/chavals/2941676828)\n  * [nel profondo del blu](http://www.flickr.com/photos/shamballah/2038749488)\n  * [Reykjavík revisited](http://www.flickr.com/photos/giesenbauer/4951425521)\n","readmeFilename":"README.md","_id":"colour-extractor@0.2.1","dist":{"shasum":"34bc278336c17d6e6d328bb6c82f397bb2cdb1ba","tarball":"https://registry.npmjs.org/colour-extractor/-/colour-extractor-0.2.1.tgz","integrity":"sha512-hVf5p5TME7tH+q3yGk5jQ7Qrh5WpIWRQMfxpUvKXv4y6ZaP5dkZeMORGgYSFuSQemBXAFDywAR2I519aqR0Btw==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIEqZYFkNmoLy/HGr4BBb66Sf8uNNyzS5q7oNRORMO/24AiAOuxR98LE+e54jkLOwNhLXcHPWoTyXNb4205vFi79Big=="}]},"_npmVersion":"1.1.69","_npmUser":{"name":"josip","email":"josip@jlx.cc"},"maintainers":[{"name":"josip","email":"josip@jlx.cc"}],"deprecated":"Package no longer supported. Upgrade to @colour-extractor/colour-extractor."}},"maintainers":[{"name":"josip","email":"josip@jlx.cc"}],"time":{"modified":"2023-05-11T14:46:04.526Z","created":"2011-03-21T00:27:54.826Z","0.1.0":"2011-03-21T00:27:55.380Z","0.2.0":"2013-02-11T02:39:17.105Z","0.2.1":"2013-02-11T15:49:23.516Z"},"author":{"name":"Josip Lisec","email":"josip@jlx.cc","url":"http://jlx.cc"},"repository":{"type":"git","url":"git://github.com/josip/node-colour-extractor.git"},"users":{"xuomo":true,"dheerajvs":true,"webkowski":true}}