{"id":17888258,"url":"https://github.com/squat/node-jp2a","last_synced_at":"2025-04-03T02:42:48.861Z","repository":{"id":12915069,"uuid":"15592486","full_name":"squat/node-jp2a","owner":"squat","description":"A node wrapper for the jp2a CLI tool","archived":false,"fork":false,"pushed_at":"2014-01-02T20:48:37.000Z","size":128,"stargazers_count":5,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-30T05:35:05.881Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/squat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-01-02T20:02:32.000Z","updated_at":"2022-06-06T18:05:47.000Z","dependencies_parsed_at":"2022-09-10T17:12:14.022Z","dependency_job_id":null,"html_url":"https://github.com/squat/node-jp2a","commit_stats":null,"previous_names":["lsvx/node-jp2a"],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squat%2Fnode-jp2a","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squat%2Fnode-jp2a/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squat%2Fnode-jp2a/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/squat%2Fnode-jp2a/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/squat","download_url":"https://codeload.github.com/squat/node-jp2a/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246927809,"owners_count":20856193,"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":[],"created_at":"2024-10-28T13:36:55.801Z","updated_at":"2025-04-03T02:42:48.839Z","avatar_url":"https://github.com/squat.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# node-jp2a\n\nnode-jp2a is a node module for the [jp2a](http://csl.name/jp2a/) CLI tool. jp2a is a small utility that converts JPG images to ASCII. It's written in C and released under the [GPL](http://www.gnu.org/copyleft/gpl.html).\n\n## Installation\n\nInstall with [npm](https://npmjs.org/):\n\n    $ npm install jp2a\n\nnode-jp2a requires that the jp2a CLI tool be installed and available on the system's $PATH. The jp2a tool is a popular and widely available utility that should be avaiable in your system's package manager.\n\nFor example:\n\n* on OS X you can install jp2a with [Homebrew](http://brew.sh/) by running: `$ brew install jp2a`\n\n* on Ubuntu/Debian you can install jp2a with `apt-get`: `$ sudo apt-get install jp2a`\n\nPlease refer to the [jp2a](http://csl.name/jp2a/) documentation for help installing the tool.\n\n## Example\n\n````js\nvar jp2a = require( \"jp2a\" );\n\njp2a( [ \"oktocat.jpg\", \"--width=50\", \"--background=light\" ],  function( output ){\n    console.log( output );\n});\n\n/*\n               ..',,'..\n          ,okXNNNNNNNNNNKkl,\n       cONNNNNNNNNNNNNNNNNNNNO:\n    .dNNNNNNNNNNNNNNNNNNNNNNNNNXo\n   cXNNNK;:oONNNNNNNNNNNNOo:;XNNNX:\n  xNNNNNc     '.     ..'     oNNNNNo\n dNNNNNNo                    xNNNNNNl\n,NNNNNNk                      ONNNNNN.\nxNNNNNN.                      .NNNNNNo\n0NNNNNX                        NNNNNNk\nkNNNNNN.                      ,NNNNNNd\n:NNNNNNO                     .0NNNNNN,\n ONNNNNNKc.                .lXNNNNNNk\n .0NNd,l0NNKxo:        cokKNNNNNNNNO\n   kNNN:.d0NNK;        lNNNNNNNNNNx\n    ;KNNl.. ..         ,NNNNNNNN0,\n      ,kNNX00K.        ,NNNNNNx'\n         ;d0NN.        ,NN0o,\n             .          .\n*/\n````\n## API\n\n### jp2a(options, callback(output))\n\nnode-jp2a expects two arguments, an options variable and a callback. The options variable can be a simple string containing a path to a local or remote jpg or it can be more complex and can be an array or hash of valid jp2a arguments. The only truly required argument is a file source.\n\nExample with a string options argument and external file source:\n\n````js\njp2a( \"http://i1.sndcdn.com/artworks-000007199965-plnzsu-original.jpg\", function( output ){\n    console.log( output );\n});\n\n/*\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMNMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMKx:. 'OMMMMMMM\nMMMMWlldkKNMMMMMMMMMMMMMMMMMMMMMMMMWOo,        ,NMMMMM\nMMMW,       .,cok0NMMMMMMMMMMMMXxc.             .KMMMM\nMMM;                ;XMMMMMMNl.                   KMMM\nMMx                'WMMMMMMMMMO.                  .WMM\nMW.                kMMMMKd;.:XMN                   lMM\nMx                 cMMc      .NW.                   NM\nM:                  ,k0:      l'                    xM\nM;                                                  :M\nMc                                                  ;M\nM0                                                  lM\nMM,                                                 KM\nMMN.                     .lk0k:                    cMM\nMMMN,                    KMMMMMd                  'WMM\nMMMMMx                   0MMMMMW.                ,WMMM\nMMMMMMWo.                'WMMMMM'               dMMMMM\nMMMMMMMMMKo'              ;WMMMM.             :XMMMMMM\nMMMMMMMMMMMMWKxc,.         'NMMK           .lNMMMMMMMM\nMMMMMMMMMMMMMMMMMMMNX0OkxxxxKMM;        .:OWMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMk     .;dKMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMX,;lx0WMMMMMMMMMMMMMMMMMM\nMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM\n*/\n````\n\nExample with hash of options:\n\n````js\njp2a( { src:\"node.jpg\", background:\"light\", colors: true }, function( output ){\n    console.log( output );\n});\n\n/*\n                                                    ;xN'\n                                                  cWMMM'\n        ..                 .                 .    xMMMW.        .\n     'cx00Oo;.         .;oO0Od:.          'cx00xc.kMMMW.    .:x00Od:.\n .;dO000000000kl'   'ck000000000Oo,   .;dO00000kc.kMMMM..;oO000000000Ol,\nOK0000Od:,lk0000KXO000000kl;cx00000KOO00000Od:.   xMMMMKK00000x:,cx0000KXo\nKXXXO'      .lNWMMNXXXKc.     .,KNMMWXXXKd'       xMMMMNXXXK,  ... .:NWMMx\nKXXXk        ;MMMMNXXXX.        NMMMWXXXXc        dMMMMNXXXK  ,,,,, .MMW0;\nKXXXk        ;MMMMNXXXX.        NMMMWXXXXc        dMMMMNXXXK  ..''. .d,\nKXXXO        ;MMMMNXXXXKx:.  ;xNMMMMWXXXXXkc.  .l0MMMMMNXXXXKx;.\n,o0XO        ;MWOl,lOXXXXXXKWMMMMMXd;ckXXXXXX0NMMMMMWOl,lOXXXXXX'\n   .,        .,      .;o0XXNMMNkc.      ,lOXXXMMMKo,      .;o0XX'\n                         .:dl'             .;od;.             .:.\n*/\n````\n\n#### Advanced\n\nnode-jp2a allows you to pipe file data directly into jp2a's STDIN rather than supply jp2a with a file path. This is useful in applications where you are generating or manipulating jpgs on the fly and do not want to save an image to the file system. To do this, set the `data` attribute in the options hash. It should be noted that `data` takes priority over `src`.\n\nExample using STDIN:\n\n````js\n/* Use https://github.com/rsms/node-imagemagick to convert a png to a jpg. */\nvar im = require( \"imagemagick\" );\n\nim.resize( {\n    srcData: fs.readFileSync( \"raspberrypi.png\", \"binary\" ),\n    width: 1000\n}, function( err,stdout ){\n    jp2a( { data: stdout, background: \"light\", width: 50, colors: true }, function( out ){\n        console.log( out )\n    });\n});\n\n/*\n         :oX0XNkk:'           .,dx0W0X0c'\n  .coKNWMNNKXKXNWWWkl.    ;dKWMXWKNKNNWMNNkl;\n  OMXkdcllcccccclod0XMd .XW0OlocccccccollkOWM'\n  KMKlcccloocccccccccOM0WNoccccccccloolcccxWM;\n  cMWxccccclxkOdlcccccKMMocccccokOkdccccclKMN\n   OMNoccccccclxKKklclXMMxccdOKOocccccccckMM'\n    kMNxccccccccco0WXWMMMMNNNxcccccccccl0MW,\n     ,NMXklcccccccxWMMMMMMMMKlcccccccdOWMx\n       '0MNX0xkOKNMMMWNNNWMMMMX0OxkKNWNo.\n       lXMNX0000WMXOxxxxxxxOXMN000KXWM0;\n     .XMXkxxxxONMKxxxxxxxxxxx0MXkxxxxONM0\n    .WM0xxxxONMMMMKOkxxxxxxk0WMMMXOxxxxXMK\n    oMNxxOKWMNX000KNMWWWWWMX0OOO0XWW0kxkMM'\n   'KMWNWMMXkxxxxxxxkXMMMWkxxxxxxxx0WMNXMM0,\n .0MW00WMMOxxxxxxxxxxxWMMOxxxxxxxxxxkWMNk0NMK.\n'WM0xxxXMKxxxxxxxxxxxxNMMOxxxxxxxxxxx0M0xxx0MW.\nKMKxxxxXMKxxxxxxxxxxxOMMMNxxxxxxxxxxxOMKxxxxXMO\nWM0xxxxWMWkxxxxxxxxx0MMMMMWOxxxxxxxxkNMWxxxxKMK\nxMNxxx0MMMMXOkxxkOKWWXKKKXNMWKOOkO0XMMMM0xxkWMc\n OMNO0MMMMMMMMMMMMKkxxxxxxxx0WMMMMMMWXKXNK0WMo\n  dMMMKxxxOKWMMMMOxxxxxxxxxxxkWMMMXOxxxxxWMMc\n   XMWxxxxxxx0WMWxxxxxxxxxxxxxXMWOxxxxxxxKMX\n   'MMkxxxxxxxkWMOxxxxxxxxxxxkWWkxxxxxxxxNMx\n    xMWkxxxxxxxOMMKkxxxxxxxkKWMOxxxxxxxxKMN.\n     lWMKkxxxxxkMMMMWXKKKXNMMMMOxxxxxx0WMO.\n      .oXMWXKKXWMMWXK000000KXWMWXKKXNMWx'\n         .:OMMMMM0xxxxxxxxxxxxWMMMWO:.\n             ,o0WWKkxxxxxxxkKWM0o'\n                .lKMWNXXXNWMXd.\n                   .o0NWWKd'\n*/\n````\n\n## License\n\nGPL\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquat%2Fnode-jp2a","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsquat%2Fnode-jp2a","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsquat%2Fnode-jp2a/lists"}