{"_id":"@depup/get-image-colors","name":"@depup/get-image-colors","dist-tags":{"latest":"4.0.1-depup.0"},"versions":{"4.0.1-depup.0":{"name":"@depup/get-image-colors","version":"4.0.1-depup.0","description":"Extract colors from images. Supports GIF, JPG, PNG, and even SVG! (with updated dependencies)","main":"index.js","scripts":{"test":"mocha && standard && standard-markdown *.md","lint":"standard"},"repository":{"type":"git","url":"git+https://github.com/colorjs/get-image-colors.git"},"keywords":["get-image-colors","depup","updated-dependencies","security","latest","patched","color","palette","svg","gif","png","jpg","canvas","pixels","rgb","rgba"],"author":{"name":"zeke"},"license":"MIT","devDependencies":{"mocha":"^8.1.1","standard":"^14.3.4","standard-markdown":"^6.0.0"},"dependencies":{"chroma-js":"^3.2.0","get-pixels":"^3.3.3","get-rgba-palette":"^2.0.1","get-svg-colors":"^2.0.1","pify":"^6.1.0"},"standard":{"env":{"mocha":true}},"depup":{"changes":{"chroma-js":{"from":"^2.1.0","to":"^3.2.0"},"get-pixels":{"from":"^3.3.2","to":"^3.3.3"},"get-svg-colors":{"from":"^2.0.0","to":"^2.0.1"},"pify":{"from":"^5.0.0","to":"^6.1.0"}},"depsUpdated":4,"originalPackage":"get-image-colors","originalVersion":"4.0.1","processedAt":"2026-03-19T03:32:47.662Z","smokeTest":"failed"},"gitHead":"1aeca80fca8a578b05958d2ca147dabbd5b90c4d","_id":"@depup/get-image-colors@4.0.1-depup.0","bugs":{"url":"https://github.com/colorjs/get-image-colors/issues"},"homepage":"https://github.com/colorjs/get-image-colors#readme","_nodeVersion":"24.14.0","_npmVersion":"11.9.0","dist":{"integrity":"sha512-x1N3wj7QjDz1RXfr48gMs6N4pDHM+1R8Czt7+tupZy1HfVALyAxykH+8iAfjGOpkd4bDL53nPKeMYRtBgy/QeA==","shasum":"d28bb028dec9917e281cb361e5f9483d5d6c53bd","tarball":"https://registry.npmjs.org/@depup/get-image-colors/-/get-image-colors-4.0.1-depup.0.tgz","fileCount":11,"unpackedSize":299363,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQCn6Kb00SuZmojNPTq5vAO0I+d6sZj+7X8NHCcZiMBTQgIhAKqwQV7KJOP17kpSndn7l+N3iRp0AzkKKh0TMfNEXcMp"}]},"_npmUser":{"name":"chiefmikey","email":"wolfemikl@gmail.com"},"directories":{},"maintainers":[{"name":"chiefmikey","email":"wolfemikl@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/get-image-colors_4.0.1-depup.0_1773891174113_0.2704561398382068"},"_hasShrinkwrap":false}},"time":{"created":"2026-03-19T03:32:53.970Z","4.0.1-depup.0":"2026-03-19T03:32:54.297Z","modified":"2026-03-19T03:32:54.480Z"},"maintainers":[{"name":"chiefmikey","email":"wolfemikl@gmail.com"}],"description":"Extract colors from images. Supports GIF, JPG, PNG, and even SVG! (with updated dependencies)","homepage":"https://github.com/colorjs/get-image-colors#readme","keywords":["get-image-colors","depup","updated-dependencies","security","latest","patched","color","palette","svg","gif","png","jpg","canvas","pixels","rgb","rgba"],"repository":{"type":"git","url":"git+https://github.com/colorjs/get-image-colors.git"},"author":{"name":"zeke"},"bugs":{"url":"https://github.com/colorjs/get-image-colors/issues"},"license":"MIT","readme":"# get-image-colors\n\nExtract colors from images. Supports GIF, JPG, PNG, and even SVG!\n\n![example color palette](https://cldup.com/-uw9Ub6L6s.png)\n\n## Installation\n\n```sh\nnpm install get-image-colors --save\n```\n\nThis package is intended for use in node environments. It won't work in a browser because it has node-specific dependencies.\n\n**Note:** when installing with webpack, if you get the error \n```\nCan't resolve 'fs' in '/node_modules/get-svg-colors' \n```\nas per an [open issue in webpack-contrib](https://github.com/webpack-contrib/css-loader/issues/447), you will need to add `node: { fs: 'empty' }` to your `webpack.base.config`:\n```\nmodule.exports = {\n    ... ,\n    node: { fs: 'empty' }\n}\n```\n\n## Usage\n\n```js\nconst path = require('path')\nconst getColors = require('get-image-colors')\n\ngetColors(path.join(__dirname, 'double-rainbow.png')).then(colors => {\n  // `colors` is an array of color objects\n})\n```\n\nYou can also use a buffer as an input source.\n```js\nconst fs = require('fs')\nconst buffer = fs.readFileSync(path.join(__dirname, 'double-rainbow.gif'))\nconst getColors = require('get-image-colors')\n\ngetColors(buffer, 'image/gif').then(colors => {\n  // `colors` is an array of color objects\n})\n```\n\n`colors` is an array of [chroma.js](http://gka.github.io/chroma.js) color objects. chroma.js objects have methods that lets you pick the color format you want (RGB hex, HSL, etc), and give you access to powerful color manipulation features:\n\n```js\ncolors.map(color => color.hex())\n// => ['#FFFFFF', '#123123', '#F0F0F0']\n\ncolors[0].alpha(0.5).css()\n// => 'rgb(0,128,128)''\n```\n\nIf you don't like promises, you can use node-style callbacks too:\n\n```js\ngetColors(filename, function (err, colors) {\n  if (err) throw err\n  // ...\n})\n```\n\nThe default number of colors returned is 5.  You can specify a different number of colors by passing an options object into the call to getColors:\n\n```js\nconst path = require('path')\nconst getColors = require('get-image-colors')\n\nconst options = {\n  count: 10,\n  type: 'image/png'\n}\ngetColors(path.join(__dirname, 'double-rainbow.png'), options).then(colors => {\n  // `colors` is an array of 10 color objects\n})\n```\n\n## How it Works\n\n`get-image-colors` uses [get-pixels](http://npm.im/get-pixels) to create a pixel array, then extracts a color palette with [get-rgba-palette](http://npm.im/get-rgba-palette), which uses [quantize](http://npm.im/quantize) under the hood.\n\nColors are converted from [get-rgba-palette's flat array format](https://github.com/mattdesl/get-rgba-palette#palettepixels-count-quality-filter) into [chroma.js color instances](http://gka.github.io/chroma.js/).\n\n## Tests\n\n```sh\nnpm install\nnpm test\n```\n\n## Dependencies\n\n- [chroma-js](https://github.com/gka/chroma.js): JavaScript library for color conversions\n- [get-pixels](https://github.com/scijs/get-pixels): Reads the pixels of an image as an ndarray\n- [get-rgba-palette](https://github.com/mattdesl/get-rgba-palette): gets a palette of prominent colors from an array of pixels\n- [get-svg-colors](https://github.com/colorjs/get-svg-colors): Extract stroke and fill colors from SVG files\n\n## Dev Dependencies\n\n- [mocha](https://github.com/mochajs/mocha): simple, flexible, fun test framework\n\n## License\n\nMIT\n","readmeFilename":"readme.md","_rev":"1-e5696a5597f8dc494ee0cf6dba9c5a55"}