{"id":20776413,"url":"https://github.com/abdelaziz18003/ndarray-imhist","last_synced_at":"2025-04-30T17:43:14.125Z","repository":{"id":34923952,"uuid":"191039893","full_name":"Abdelaziz18003/ndarray-imhist","owner":"Abdelaziz18003","description":"📊 A package to plot images' histograms using node.js and Gnuplot inspired by Matlab `imhist` command..","archived":false,"fork":false,"pushed_at":"2022-12-10T05:34:40.000Z","size":117,"stargazers_count":4,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-22T19:47:37.410Z","etag":null,"topics":["histogram","image-processing","matlab","ndarray"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/ndarray-imhist","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/Abdelaziz18003.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-09T18:14:29.000Z","updated_at":"2023-07-30T14:46:30.000Z","dependencies_parsed_at":"2023-01-15T10:31:29.211Z","dependency_job_id":null,"html_url":"https://github.com/Abdelaziz18003/ndarray-imhist","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelaziz18003%2Fndarray-imhist","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelaziz18003%2Fndarray-imhist/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelaziz18003%2Fndarray-imhist/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Abdelaziz18003%2Fndarray-imhist/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Abdelaziz18003","download_url":"https://codeload.github.com/Abdelaziz18003/ndarray-imhist/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251753442,"owners_count":21638310,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["histogram","image-processing","matlab","ndarray"],"created_at":"2024-11-17T13:08:07.008Z","updated_at":"2025-04-30T17:43:14.088Z","avatar_url":"https://github.com/Abdelaziz18003.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ndarray-imhist\n\nA package to plot grayscale images' histograms using node.js and Gnuplot, inspired by Matlab `imhist` command.\n\n## Installation\n\n```bash\nnpm install ndarray-imhist\n```\n\n[Gnuplot](http://www.gnuplot.info/) is required for this package to work. Make sure that it is installed and added to the path correctly by typing:\n\n```bash\ngnuplot --version\n```\n\n## Usage\n\n### Syntax\n\n```js\nimhist(img [, options]);\n// or\nlet [x, y] = imhist(img [, options]);\n```\n\ndisplays the histogram of a grayscale image `img` (should be an [ndarray](https://github.com/scijs/ndarray)) and return the historgram data as an array of two arrays containing `x` and `y` values respectively.\n\n### Options\n\nOption  | required | default | description\n------- | -------- | ------- | -----------\nchannel | no       | 0       | Select the RGB channel to get the historgram for. `0` for the red channel, `1` for the green and `2` for the blue one. If `img` is a 2D array, this option has no effect.\ncolor   | no       | \"blue\"  | Set the impulses color, must be a valid Gnuplot \"rgbcolor\". Otherwise, plotting will fail silently\nplot    | no       | true    | If true, plot the histogram using Gnuplot. Otherwise, return just the histogram data.\n\n\n### Examples\n\n```js\nconst getPixels = require(\"get-pixels\");\nconst imhist = require(\"ndarray-imhist\");\n\ngetPixels(\"lena.png\", function(err, pixels) {\n  if(!err \u0026\u0026 pixels) {\n    // show the image histogram\n    imhist(pixels);\n\n    // return the image histogram data without plotting it.\n    let [x, y] = imhist(pixels, {plot: false});\n    console.log(x, y);\n  }\n})\n```\n\nHere is how the histogram will look like: \n\n![ndarray-imhist](https://user-images.githubusercontent.com/11301627/59524131-02eb6f80-8ecb-11e9-893d-90c39f50e800.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdelaziz18003%2Fndarray-imhist","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fabdelaziz18003%2Fndarray-imhist","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fabdelaziz18003%2Fndarray-imhist/lists"}