{"id":13562610,"url":"https://github.com/kodie/img-items","last_synced_at":"2026-01-20T07:02:10.652Z","repository":{"id":57272536,"uuid":"379086684","full_name":"kodie/img-items","owner":"kodie","description":"Finds individual items inside an image and gets their size/coordinates.","archived":false,"fork":false,"pushed_at":"2023-01-06T19:45:38.000Z","size":1313,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-14T13:32:48.226Z","etag":null,"topics":["detect","extract","image","image-processing","nodejs","screenshot"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kodie.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-06-21T23:19:44.000Z","updated_at":"2024-10-20T05:30:11.000Z","dependencies_parsed_at":"2023-02-06T08:16:50.471Z","dependency_job_id":null,"html_url":"https://github.com/kodie/img-items","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/kodie/img-items","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodie%2Fimg-items","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodie%2Fimg-items/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodie%2Fimg-items/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodie%2Fimg-items/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kodie","download_url":"https://codeload.github.com/kodie/img-items/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kodie%2Fimg-items/sbom","scorecard":{"id":565635,"data":{"date":"2025-08-11","repo":{"name":"github.com/kodie/img-items","commit":"e4a44aeb154f5612ee115c637fecdc26945fc4c1"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Code-Review","score":0,"reason":"Found 0/9 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: license.md:0","Info: FSF or OSI recognized license: MIT License: license.md:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'main'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"31 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-968p-4wvh-cqc8","Warn: Project is vulnerable to: GHSA-67hx-6x53-jw92","Warn: Project is vulnerable to: GHSA-v88g-cgmw-v5xw","Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-grv7-fg5c-xmjg","Warn: Project is vulnerable to: GHSA-6cpc-mj5c-m9rq","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-w573-4hg7-7wgq","Warn: Project is vulnerable to: GHSA-fjxv-7rqg-78g4","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-w7q9-p3jq-fmhm","Warn: Project is vulnerable to: GHSA-xvf7-4v9q-58w6","Warn: Project is vulnerable to: GHSA-896r-f27r-55mw","Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h","Warn: Project is vulnerable to: GHSA-952p-6rrq-rcjv","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-x565-32qp-m3vf","Warn: Project is vulnerable to: GHSA-hrpp-h998-j3pp","Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-38fc-wpqx-33j7","Warn: Project is vulnerable to: GHSA-v4rh-8p82-6h5w","Warn: Project is vulnerable to: GHSA-j8xg-fqg3-53r7","Warn: Project is vulnerable to: GHSA-776f-qx25-q3cc","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-20T14:54:49.488Z","repository_id":57272536,"created_at":"2025-08-20T14:54:49.488Z","updated_at":"2025-08-20T14:54:49.488Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28597985,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-20T02:08:49.799Z","status":"ssl_error","status_checked_at":"2026-01-20T02:08:44.148Z","response_time":117,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["detect","extract","image","image-processing","nodejs","screenshot"],"created_at":"2024-08-01T13:01:10.362Z","updated_at":"2026-01-20T07:02:10.635Z","avatar_url":"https://github.com/kodie.png","language":"JavaScript","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"readme":"# img-items\n\n[![npm package version](https://img.shields.io/npm/v/img-items.svg?style=flat-square)](https://www.npmjs.com/package/img-items)\n[![Travis build status](https://img.shields.io/travis/com/kodie/img-items.svg?style=flat-square)](https://travis-ci.com/kodie/img-items)\n[![npm package downloads](https://img.shields.io/npm/dt/img-items.svg?style=flat-square)](https://www.npmjs.com/package/img-items)\n[![code style](https://img.shields.io/badge/code_style-standard-yellow.svg?style=flat-square)](https://github.com/standard/standard)\n[![license](https://img.shields.io/github/license/kodie/img-items.svg?style=flat-square)](license.md)\n\nFinds individual items inside an image and gets their size/coordinates. Uses [Jimp] as an image processor so no native dependencies or binaries required.\n\n## Example\n\n| Source                       | Result                              |\n:-----------------------------:|:------------------------------------:\n| ![](assets/feed-example.png) | ![](assets/feed-example-filled.png) |\n\n```js\nconst Jimp = require('jimp')\nconst imgItems = require('img-items')\n\nJimp.read('assets/feed-example.png')\n  .then(image =\u003e {\n    return imgItems(image)\n      .then(items =\u003e {\n        items.forEach((item, i) =\u003e {\n          image.scan(item.left, item.top, item.width, item.height, function (x, y, idx) {\n            this.bitmap.data.writeUInt32BE(Jimp.cssColorToHex('#ff0000'), idx, true)\n          })\n        })\n\n        return image.writeAsync('assets/feed-example-filled.png')\n      })\n  })\n```\n\n## Caveat\n\nThe larger the image and/or the more background colors defined to compare against, the slower the module will run. There are more than likely some things that could be approved upon to make it more efficient but it does work as is.\n\n## Installation\n\n```shell\nnpm install --save img-items\n```\n\n## Usage\n\n`imgItems(image, options, callback)`\n\n```js\nconst imgItems = require('img-items')\n\nconst options = {\n  background: 0,\n  backgroundThreshold: 5,\n  gapThreshold: 5,\n  sizeThreshold: 5\n}\n\nimgItems('my-image.jpg', options)\n  .then(items =\u003e {\n    // Do stuff with the array of items\n  })\n  .catch(err =\u003e {\n    // Handle any errors\n  })\n\n// or use a callback\nimgItems('my-image.jpg', options, (err, items) =\u003e {\n  if (err) {\n    // Handle any errors\n    return\n  }\n\n  // Do stuff with the array of items\n})\n```\n\n### Parameters\n\n#### `image`\n\nThe image to scan for items. Accepts anything that [Jimp] accepts as a source image so file path, URL, buffer, or a Jimp instance.\n\n#### `options`\n\nAn object with options you can set to tweak how items are found:\n\n  * `background` (Default: `0`) - The color(s) that should be considered the background of the image. Accepts a string with a CSS hex color value (ex. `#FFFFFF`), an integer with a color hex (ex. `0xFFFFFFFF`), an array containing the before mentioned types, an integer set to `0` to use the top left pixel color, an integer set to `-1` to set the background color to either black or white depending on the average luminance of the image, or an integer from `1` to `10` to use that number of primary colors from the image. *(Keep in mind that the more colors that are defined here, the slower the module will run.)*\n\n  * `backgroundThreshold` (Default: `5`) - An integer from `0` to `100` defining how close a color can be to the background color (using the [CIE76 Color Difference Formula](https://en.wikipedia.org/wiki/Color_difference#CIE76)) for it to be considered part of the background. `0` being an exact match.\n\n  * `gapThreshold` (Default: `5`) - An integer defining how many pixels of background color before an item is considered it's own item.\n\n  * `gapYThreshold` (Default: `null`) - The same as `gapThreshold` but only on the `Y` axis. (Setting to `null` will fallback to `gapThreshold`)\n\n  * `gapXThreshold` (Default: `null`) - The same as `gapThreshold` but only on the `X` axis. (Setting to `null` will fallback to `gapThreshold`)\n\n  * `sizeThreshold` (Default: `5`) - An integer defining how many pixels wide and high an item should be to make the cut. If an item has a width or height lower than this value it will be filtered out of the results.\n\n  * `heightThreshold` (Default: `null`) - The same as `sizeThreshold` but only for the item's height. (Setting to `null` will fallback to `sizeThreshold`)\n\n  * `widthThreshold` (Default: `null`) - The same as `sizeThreshold` but only for the item's width. (Setting to `null` will fallback to `sizeThreshold`)\n\n#### `callback`\n\nA function to run after the scan is finished that receives any errors that occurred as the first parameter and the items array as the second.\n\n### Example Response\n\n```js\n[\n  {\n    left: 728,\n    top: 42,\n    right: 782,\n    bottom: 62,\n    width: 55,\n    height: 21\n  },\n  {\n    left: 47,\n    top: 44,\n    right: 58,\n    bottom: 61,\n    width: 12,\n    height: 18\n  },\n  {\n    left: 66,\n    top: 44,\n    right: 93,\n    bottom: 61,\n    width: 28,\n    height: 18\n  }\n]\n```\n\n## Related\n\n - [php-img-items](https://github.com/kodie/php-img-items) - A PHP port of this module.\n\n## License\n\nMIT. See the [license.md file](license.md) for more info.\n\n[Jimp]: https://www.npmjs.com/package/jimp\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodie%2Fimg-items","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkodie%2Fimg-items","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkodie%2Fimg-items/lists"}