{"id":15025647,"url":"https://github.com/ionicabizau/image-to-ascii","last_synced_at":"2025-05-14T00:02:55.277Z","repository":{"id":16011596,"uuid":"18755064","full_name":"IonicaBizau/image-to-ascii","owner":"IonicaBizau","description":":floppy_disk: A Node.js module that converts images to ASCII art.","archived":false,"fork":false,"pushed_at":"2025-02-13T20:07:45.000Z","size":485,"stargazers_count":1611,"open_issues_count":4,"forks_count":107,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-05-09T02:41:25.799Z","etag":null,"topics":["ascii-art","hacktoberfest","mad-science"],"latest_commit_sha":null,"homepage":"http://ionicabizau.net/blog/16","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/IonicaBizau.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":"ionicabizau","patreon":"ionicabizau","open_collective":"ionicabizau","custom":"https://www.buymeacoffee.com/h96wwchmy"}},"created_at":"2014-04-14T09:20:22.000Z","updated_at":"2025-05-02T03:50:07.000Z","dependencies_parsed_at":"2024-01-13T18:00:23.355Z","dependency_job_id":"20a12ed0-e44a-4025-8970-cdb31aa03317","html_url":"https://github.com/IonicaBizau/image-to-ascii","commit_stats":{"total_commits":150,"total_committers":17,"mean_commits":8.823529411764707,"dds":0.5933333333333333,"last_synced_commit":"2fa18b7fb351336a82eb9d7a1313ff3cad535cd4"},"previous_names":[],"tags_count":29,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonicaBizau%2Fimage-to-ascii","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonicaBizau%2Fimage-to-ascii/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonicaBizau%2Fimage-to-ascii/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/IonicaBizau%2Fimage-to-ascii/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/IonicaBizau","download_url":"https://codeload.github.com/IonicaBizau/image-to-ascii/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254043268,"owners_count":22004913,"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":["ascii-art","hacktoberfest","mad-science"],"created_at":"2024-09-24T20:02:44.172Z","updated_at":"2025-05-14T00:02:55.168Z","avatar_url":"https://github.com/IonicaBizau.png","language":"JavaScript","funding_links":["https://github.com/sponsors/ionicabizau","https://patreon.com/ionicabizau","https://opencollective.com/ionicabizau","https://www.buymeacoffee.com/h96wwchmy","https://www.buymeacoffee.com/H96WwChMy","https://www.patreon.com/ionicabizau","https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=RVXDDLKKLQRJW"],"categories":[],"sub_categories":[],"readme":"\u003c!-- Please do not edit this file. Edit the `blah` field in the `package.json` instead. If in doubt, open an issue. --\u003e\n\n\n\n\n\n\n\n\n[![image-to-ascii](http://i.imgur.com/pKydY5P.png)](#)\n\n\n\n\n\n\n\n\n\n\n\n# image-to-ascii\n\n [![Support me on Patreon][badge_patreon]][patreon] [![Buy me a book][badge_amazon]][amazon] [![PayPal][badge_paypal_donate]][paypal-donations] [![Ask me anything](https://img.shields.io/badge/ask%20me-anything-1abc9c.svg)](https://github.com/IonicaBizau/ama) [![Version](https://img.shields.io/npm/v/image-to-ascii.svg)](https://www.npmjs.com/package/image-to-ascii) [![Downloads](https://img.shields.io/npm/dt/image-to-ascii.svg)](https://www.npmjs.com/package/image-to-ascii) [![Get help on Codementor](https://cdn.codementor.io/badges/get_help_github.svg)](https://www.codementor.io/@johnnyb?utm_source=github\u0026utm_medium=button\u0026utm_term=johnnyb\u0026utm_campaign=github)\n\n\u003ca href=\"https://www.buymeacoffee.com/H96WwChMy\" target=\"_blank\"\u003e\u003cimg src=\"https://www.buymeacoffee.com/assets/img/custom_images/yellow_img.png\" alt=\"Buy Me A Coffee\"\u003e\u003c/a\u003e\n\n\n\n\n\n\n\n\u003e A Node.JS module that converts images to ASCII art.\n\n\n\n\n\n\n\n\n\n\n\n[![image-to-ascii](http://i.imgur.com/Om8G7dZ.png)](#)\n\n\n\n\n\n\n\n## :cloud: Installation\n\n```sh\n# Using npm\nnpm install --save image-to-ascii\n\n# Using yarn\nyarn add image-to-ascii\n```\n\n\n:bulb: **ProTip**: You can install the [cli version of this module](https://github.com/IonicaBizau/image-to-ascii-cli) by running `npm install --global image-to-ascii-cli` (or `yarn global add image-to-ascii-cli`).\n\n\n\n\n\n\n\nCheck out the [INSTALLATION.md](INSTALLATION.md) guide for more information.\n\n\n\n\n\n\n\n## :clipboard: Example\n\n\n\n```js\n// Dependencies\nconst imageToAscii = require(\"image-to-ascii\");\n\n// The path can be either a local path or an url\nimageToAscii(\"https://octodex.github.com/images/octofez.png\", (err, converted) =\u003e {\n    console.log(err || converted);\n});\n\n// Passing options\nimageToAscii(\"https://octodex.github.com/images/privateinvestocat.jpg\", {\n    colored: false\n}, (err, converted) =\u003e {\n    console.log(err || converted);\n});\n```\n\n\n\n\n\n\n\nIn order to run the `webcam.sh` provided in the `example` folder, you will also need streamer. The script uses streamer to make webcam pictures and converts them into ASCII art using the `webcam.js`\n\n```sh\n# Ubuntu\n$ sudo apt-get install streamer\n\n# CentOS / RHEL\n$ sudo yum install --enablerepo epel GraphicsMagick\n```\n\n\nTo run the script just use:\n\n```sh\nsh webcam.sh\n```\n\n\n\n\n\n\n\n\n## :question: Get Help\n\nThere are few ways to get help:\n\n\n\n 1. Please [post questions on Stack Overflow](https://stackoverflow.com/questions/ask). You can open issues with questions, as long you add a link to your Stack Overflow question.\n 2. For bug reports and feature requests, open issues. :bug:\n 3. For direct and quick help, you can [use Codementor](https://www.codementor.io/johnnyb). :rocket:\n\n\n\n\n\n\n\n## :memo: Documentation\n\n\n### `imageToAscii(source, options, callback)`\nConverts the provided image in ASCII art.\n\n#### Params\n\n- **String|Buffer** `source`: The path/url to the image or a Buffer object.\n- **Object|String** `options`: The path to the image or an object containing the following fields:\n\n **Size Options**:\n  - `pxWidth` (Number): The pixel width used for aspect ratio (default: `2`).\n  - `size` (Object): The size of the result image (ASCII art)—interpreted by\n    [`compute-size`](https://github.com/IonicaBizau/compute-size):\n    - `height` (Number|String): The height value (default: `\"100%\"`).\n    - `width` (Number|String): The width value (default: computed value to\n       keep aspect ratio). This is optional if the height is provided.\n  - `size_options` (Object): The options for\n    [`compute-size`](https://github.com/IonicaBizau/compute-size):\n    - `screen_size` (Object): The screen size (defaults to terminal width\n    and height):\n        - `width` (Number): The screen width.\n        - `height` (Number): The screen height.\n    - `px_size` (Object): The pixel size.\n        - `width` (default: `1`)\n        - `height` (default: `1`)\n    - `preserve_aspect_ratio` (Boolean): If `false`, the aspect ratio will\n      not be preserved (default: `true`).\n    - `fit_screen` (Boolean): If `false`, the result size will not fit to\n      screen (default: `true`).\n\n **Matrix asciifier options**:\n  - `stringify` (Boolean): If `false`, the pixel objects will not be\n    stringified.\n  - `concat` (Boolean): If `false`, the pixel objects will not be joined\n    together.\n\n **Pixel asciifier options**:\n\n  - `pixels` (Array|String): An array or string containing the characters\n     used for converting the pixels in strings\n     (default: `\" .,:;i1tfLCG08@\"`).\n  - `reverse` (Boolean): If `true`, the pixels will be reversed creating a\n     *negative image* effect (default: `false`).\n  - `colored` (Boolean): If `true`, the output will contain ANSI styles\n    (default: `true`).\n  - `bg` (Boolean): If `true`, the **background** color will be used for\n    coloring (default: false).\n  - `fg` (Boolean): If `true`, the **foreground** color will be used for\n    coloring (default: true).\n  - `white_bg` (Boolean): Turn on the white background for transparent\n    pixels (default: `true`).\n  - `px_background` (Object): An object containing the `r` (red), `g`\n    (green) and `b` (blue) values of the custom background color.\n\n **Other options**:\n  - `image_type` (String): Use this to explicitely provide the image type.\n  - `stringify_fn` (Function): A function getting the `pixels` matrix and\n    the `options` in the arguments. Use this option to implement your own\n    stringifier.\n- **Function** `callback`: The callback function.\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## :yum: How to contribute\nHave an idea? Found a bug? See [how to contribute][contributing].\n\n\n## :sparkling_heart: Support my projects\nI open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously,\nthis takes time. You can integrate and use these projects in your applications *for free*! You can even change the source code and redistribute (even resell it).\n\nHowever, if you get some profit from this or just want to encourage me to continue creating stuff, there are few ways you can do it:\n\n\n - Starring and sharing the projects you like :rocket:\n - [![Buy me a book][badge_amazon]][amazon]—I love books! I will remember you after years if you buy me one. :grin: :book:\n - [![PayPal][badge_paypal]][paypal-donations]—You can make one-time donations via PayPal. I'll probably buy a ~~coffee~~ tea. :tea:\n - [![Support me on Patreon][badge_patreon]][patreon]—Set up a recurring monthly donation and you will get interesting news about what I'm doing (things that I don't share with everyone).\n - **Bitcoin**—You can send me bitcoins at this address (or scanning the code below): `1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6`\n\n    ![](https://i.imgur.com/z6OQI95.png)\n\n\nThanks! :heart:\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n## :dizzy: Where is this library used?\nIf you are using this library in one of your projects, add it in this list. :sparkles:\n\n - `@radic/cli`\n - `aceituna`\n - `adventure-cli`\n - `alphabet-cli`\n - `ascii-github`\n - `ascii-video`\n - `bing-cli`\n - `cli-emoji`\n - `cli-github`\n - `core-node-pokemon`\n - `doomjs`\n - `generator-rn-boilerplate`\n - `gif-cli`\n - `gongxi`\n - `goteem`\n - `ick`\n - `image-to-ascii-cli`\n - `image-to-js`\n - `img-to-svg`\n - `imgurize`\n - `jacky`\n - `joctodex`\n - `js2image`\n - `linterf`\n - `mdy`\n - `moltres-cli`\n - `nobro`\n - `node.cobol`\n - `noslide-js`\n - `nrk-tv-cli`\n - `path-cli`\n - `pictoprime`\n - `pokedex-cli-tt`\n - `provisiontui-david-keng`\n - `salestock-cli`\n - `sprite-cli-js`\n - `terminal-sidecar`\n - `tmuxos`\n\n\n\n\n\n\n\n\n\n\n\n## :scroll: License\n\n[MIT][license] © [Ionică Bizău][website]\n\n\n\n\n\n\n[license]: /LICENSE\n[website]: https://ionicabizau.net\n[contributing]: /CONTRIBUTING.md\n[docs]: /DOCUMENTATION.md\n[badge_patreon]: https://ionicabizau.github.io/badges/patreon.svg\n[badge_amazon]: https://ionicabizau.github.io/badges/amazon.svg\n[badge_paypal]: https://ionicabizau.github.io/badges/paypal.svg\n[badge_paypal_donate]: https://ionicabizau.github.io/badges/paypal_donate.svg\n[patreon]: https://www.patreon.com/ionicabizau\n[amazon]: http://amzn.eu/hRo9sIZ\n[paypal-donations]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick\u0026hosted_button_id=RVXDDLKKLQRJW\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fionicabizau%2Fimage-to-ascii","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fionicabizau%2Fimage-to-ascii","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fionicabizau%2Fimage-to-ascii/lists"}