Coder Social home page Coder Social logo

ionicabizau / image-to-ascii Goto Github PK

View Code? Open in Web Editor NEW
1.6K 20.0 104.0 466 KB

:floppy_disk: A Node.js module that converts images to ASCII art.

Home Page: http://ionicabizau.net/blog/16

License: MIT License

JavaScript 96.82% Shell 3.18%
mad-science ascii-art hacktoberfest

image-to-ascii's Introduction

image-to-ascii

image-to-ascii

Support me on Patreon Buy me a book PayPal Ask me anything Version Downloads Get help on Codementor

Buy Me A Coffee

A Node.JS module that converts images to ASCII art.

image-to-ascii

☁️ Installation

# Using npm
npm install --save image-to-ascii

# Using yarn
yarn add image-to-ascii

💡 ProTip: You can install the cli version of this module by running npm install --global image-to-ascii-cli (or yarn global add image-to-ascii-cli).

Check out the INSTALLATION.md guide for more information.

📋 Example

// Dependencies
const imageToAscii = require("image-to-ascii");

// The path can be either a local path or an url
imageToAscii("https://octodex.github.com/images/octofez.png", (err, converted) => {
    console.log(err || converted);
});

// Passing options
imageToAscii("https://octodex.github.com/images/privateinvestocat.jpg", {
    colored: false
}, (err, converted) => {
    console.log(err || converted);
});

In 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

# Ubuntu
$ sudo apt-get install streamer

# CentOS / RHEL
$ sudo yum install --enablerepo epel GraphicsMagick

To run the script just use:

sh webcam.sh

❓ Get Help

There are few ways to get help:

  1. Please post questions on Stack Overflow. You can open issues with questions, as long you add a link to your Stack Overflow question.
  2. For bug reports and feature requests, open issues. 🐛
  3. For direct and quick help, you can use Codementor. 🚀

📝 Documentation

imageToAscii(source, options, callback)

Converts the provided image in ASCII art.

Params

  • String|Buffer source: The path/url to the image or a Buffer object.
  • Object|String options: The path to the image or an object containing the following fields:

Size Options:

  • pxWidth (Number): The pixel width used for aspect ratio (default: 2).
  • size (Object): The size of the result image (ASCII art)—interpreted by compute-size:
    • height (Number|String): The height value (default: "100%").
    • width (Number|String): The width value (default: computed value to keep aspect ratio). This is optional if the height is provided.
  • size_options (Object): The options for compute-size:
    • screen_size (Object): The screen size (defaults to terminal width and height):
      • width (Number): The screen width.
      • height (Number): The screen height.
    • px_size (Object): The pixel size.
      • width (default: 1)
      • height (default: 1)
    • preserve_aspect_ratio (Boolean): If false, the aspect ratio will not be preserved (default: true).
    • fit_screen (Boolean): If false, the result size will not fit to screen (default: true).

Matrix asciifier options:

  • stringify (Boolean): If false, the pixel objects will not be stringified.
  • concat (Boolean): If false, the pixel objects will not be joined together.

Pixel asciifier options:

  • pixels (Array|String): An array or string containing the characters used for converting the pixels in strings (default: " .,:;i1tfLCG08@").
  • reverse (Boolean): If true, the pixels will be reversed creating a negative image effect (default: false).
  • colored (Boolean): If true, the output will contain ANSI styles (default: true).
  • bg (Boolean): If true, the background color will be used for coloring (default: false).
  • fg (Boolean): If true, the foreground color will be used for coloring (default: true).
  • white_bg (Boolean): Turn on the white background for transparent pixels (default: true).
  • px_background (Object): An object containing the r (red), g (green) and b (blue) values of the custom background color.

Other options:

  • image_type (String): Use this to explicitely provide the image type.
  • stringify_fn (Function): A function getting the pixels matrix and the options in the arguments. Use this option to implement your own stringifier.
  • Function callback: The callback function.

😋 How to contribute

Have an idea? Found a bug? See how to contribute.

💖 Support my projects

I open-source almost everything I can, and I try to reply to everyone needing help using these projects. Obviously, this 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).

However, 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:

  • Starring and sharing the projects you like 🚀

  • Buy me a book—I love books! I will remember you after years if you buy me one. 😁 📖

  • PayPal—You can make one-time donations via PayPal. I'll probably buy a coffee tea. 🍵

  • Support me on 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).

  • Bitcoin—You can send me bitcoins at this address (or scanning the code below): 1P9BRsmazNQcuyTxEqveUsnf5CERdq35V6

Thanks! ❤️

💫 Where is this library used?

If you are using this library in one of your projects, add it in this list. ✨

  • ascii-video
  • js2image
  • gif-cli
  • sprite-cli-js
  • nobro
  • mdy
  • noslide-js
  • pictoprime
  • ick
  • salestock-cli
  • doomjs
  • cli-emoji
  • gongxi
  • ascii-github
  • adventure-cli
  • alphabet-cli
  • moltres-cli
  • nrk-tv-cli
  • node.cobol
  • pokedex-cli-tt
  • path-cli
  • terminal-sidecar
  • bing-cli
  • @radic/cli
  • imgurize
  • joctodex
  • tmuxos
  • jacky
  • cli-github
  • provisiontui-david-keng
  • image-to-ascii-cli
  • image-to-js
  • goteem
  • core-node-pokemon
  • img-to-svg
  • aceituna

📜 License

MIT © Ionică Bizău

image-to-ascii's People

Contributors

aleen42 avatar baer avatar benwiley4000 avatar comfreek avatar ggventurini avatar graingert avatar ionicabizau avatar lcristianiim avatar phoenixbox avatar qix- avatar rgbkrk avatar wncm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

image-to-ascii's Issues

Broken due to lwip installation issues

Can't get lwip to install on Ubuntu, which makes this module unusable :( It says to install ImageMagick if lwip doesn't work. I installed ImageMagick, but that didn't have any impact on the installation of this module.

Error: Unsupported bit depth 16

var ImageToAscii = require ("../index")
  , myImage = new ImageToAscii ({
        resize: {
            height: "100%"
        }
      , colored: true
    })
  ;

myImage.convert("https://avatars3.githubusercontent.com/u/38924?v=3&s=400", function(err, converted) {
    console.log(err || converted);
});
$ node index.js 

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Unsupported bit depth 16
    at Parser._parseIHDR (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/parser.js:180:28)
    at ChunkStream._process (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:186:23)
    at ChunkStream.read (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:51:10)
    at Parser._handleIHDR (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/parser.js:160:10)
    at Parser._parseChunkBegin (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/parser.js:121:34)
    at ChunkStream._process (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:186:23)
    at ChunkStream.read (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:51:10)
    at Parser._parseSignature (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/parser.js:91:10)
    at ChunkStream._process (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:186:23)
    at ChunkStream.write (/home/ionicabizau/image-to-ascii/node_modules/pngjs/lib/chunkstream.js:74:10)

The image is successfully resized, but it fails here.

Probably this is a bug in pngjs package which seems not to be maintained anymore. So, a code refactoring is needed. Related to #2.


@izuzak I remember this bug appeared when we met in Zurich, but I hided it by manually downloading the file and saving it in another format. 😄

Image width on scale

Hi there,

so I am trying to convert a 100px x 100px png to ascii. When I do so with the following options:

const options = {
   concat: false,
   colored: false
}
imageToAscii(image, options, (err, converted) => {
      if (err) {
        next(err, null)
      } else {
        console.log('ROWS', converted.length);
        console.log('COLS', converted[0].length);
        next(null, converted)
      }
});

I get an ascii output with the following number of rows and columns:

ROWS 60
COLS 120

I was expecting to get an output with an equal number of rows and cols (100 rows && 100 cols), thus keeping the aspect ratio. I have also been trying many variations of the options parameters, hoping to get the correctly scaled output.

Could you tell me where I am going wrong / suggest the correct options params to keep my image at the right aspect ratio?

Thanks!

image

at Socket.<anonymous> /node_modules/gm/lib/command.js:57:17)

Env 👍

1. OS : OSX 10.11.6
2. Npm: 4.0.1
3. Node 6.2.1

Error 👎

[ Error: Stream yields empty buffer
      at Socket.<anonymous> (/Users/hamma/test-img-console/node_modules/gm/lib/command.js:57:17)
      at emitNone (events.js:91:20)
      at Socket.emit (events.js:185:7)
      at endReadableNT (_stream_readable.js:926:12)
      at _combinedTickCallback (internal/process/next_tick.js:74:11)
      at process._tickCallback (internal/process/next_tick.js:98:9),
  Error: Could not execute GraphicsMagick/ImageMagick: gm "identify" "-ping" "-format" "%wx%h" "-" this most likely means the gm/convert binaries can't be found
      at ChildProcess.<anonymous> (/Users/hamma/test-img-console/nodejs-plugins/console-img/node_modules/gm/lib/command.js:232:12)
      at emitOne (events.js:96:13)
      at ChildProcess.emit (events.js:188:7)
      at Process.ChildProcess._handle.onexit (internal/child_process.js:202:12)
      at onErrorNT (internal/child_process.js:348:16)
      at _combinedTickCallback (internal/process/next_tick.js:74:11)
      at process._tickCallback (internal/process/next_tick.js:98:9) ]

Error when npm i image-to-ascii

root@malangbanget:~# npm i image-to-ascii
npm http GET https://registry.npmjs.org/image-to-ascii
npm http 200 https://registry.npmjs.org/image-to-ascii
npm ERR! Failed to parse json
npm ERR! Unexpected end of input
npm ERR! File: /root/.npm/image-to-ascii/2.2.0/package/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! file /root/.npm/image-to-ascii/2.2.0/package/package.json
npm ERR! code EJSONPARSE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/npm-debug.log
npm ERR! not ok code 0
root@malangbanget:# npm cache clean
root@malangbanget:
# npm i image-to-ascii
npm http GET https://registry.npmjs.org/image-to-ascii
npm http 200 https://registry.npmjs.org/image-to-ascii
npm http GET https://registry.npmjs.org/image-to-ascii/-/image-to-ascii-2.2.0.tgz
npm http 200 https://registry.npmjs.org/image-to-ascii/-/image-to-ascii-2.2.0.tgz
npm http GET https://registry.npmjs.org/couleurs
npm http GET https://registry.npmjs.org/gm
npm http GET https://registry.npmjs.org/pngjs/0.4.0
npm http GET https://registry.npmjs.org/request
npm http GET https://registry.npmjs.org/tmp/0.0.27
npm http 200 https://registry.npmjs.org/couleurs
npm http GET https://registry.npmjs.org/couleurs/-/couleurs-5.2.0.tgz
npm http 200 https://registry.npmjs.org/gm
npm http GET https://registry.npmjs.org/gm/-/gm-1.21.1.tgz
npm http 200 https://registry.npmjs.org/tmp/0.0.27
npm http GET https://registry.npmjs.org/tmp/-/tmp-0.0.27.tgz
npm http 200 https://registry.npmjs.org/couleurs/-/couleurs-5.2.0.tgz
npm http 200 https://registry.npmjs.org/request
npm http 200 https://registry.npmjs.org/pngjs/0.4.0
npm http GET https://registry.npmjs.org/request/-/request-2.67.0.tgz
npm http GET https://registry.npmjs.org/pngjs/-/pngjs-0.4.0.tgz
npm http 200 https://registry.npmjs.org/tmp/-/tmp-0.0.27.tgz
npm http 200 https://registry.npmjs.org/gm/-/gm-1.21.1.tgz
npm http 200 https://registry.npmjs.org/pngjs/-/pngjs-0.4.0.tgz
npm http 200 https://registry.npmjs.org/request/-/request-2.67.0.tgz
npm WARN engine [email protected]: wanted: {"node":"0.8.x"} (current: {"node":"v0.10.25","npm":"1.3.10"})
npm http GET https://registry.npmjs.org/x256/0.0.2
npm http GET https://registry.npmjs.org/typpy/2.0.0
npm http GET https://registry.npmjs.org/flat-colors/3.0.0
npm http GET https://registry.npmjs.org/os-tmpdir
npm http GET https://registry.npmjs.org/array-parallel
npm http GET https://registry.npmjs.org/debug
npm http GET https://registry.npmjs.org/array-series
npm http GET https://registry.npmjs.org/bl
npm http GET https://registry.npmjs.org/caseless
npm http GET https://registry.npmjs.org/forever-agent
npm http GET https://registry.npmjs.org/extend
npm http GET https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/mime-types
npm http GET https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/qs
npm http 200 https://registry.npmjs.org/os-tmpdir
npm http GET https://registry.npmjs.org/tunnel-agent
npm http GET https://registry.npmjs.org/tough-cookie
npm http GET https://registry.npmjs.org/http-signature
npm http GET https://registry.npmjs.org/oauth-sign
npm http GET https://registry.npmjs.org/hawk
npm http GET https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/stringstream
npm http GET https://registry.npmjs.org/combined-stream
npm http GET https://registry.npmjs.org/isstream
npm http GET https://registry.npmjs.org/is-typedarray
npm http GET https://registry.npmjs.org/har-validator
npm http 200 https://registry.npmjs.org/debug
npm http 200 https://registry.npmjs.org/x256/0.0.2
npm http 200 https://registry.npmjs.org/flat-colors/3.0.0
npm http GET https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz
npm http 200 https://registry.npmjs.org/array-series
npm http GET https://registry.npmjs.org/debug/-/debug-2.2.0.tgz
npm http GET https://registry.npmjs.org/x256/-/x256-0.0.2.tgz
npm http GET https://registry.npmjs.org/flat-colors/-/flat-colors-3.0.0.tgz
npm http 200 https://registry.npmjs.org/forever-agent
npm http 200 https://registry.npmjs.org/caseless
npm http 200 https://registry.npmjs.org/bl
npm http 200 https://registry.npmjs.org/extend
npm http 200 https://registry.npmjs.org/json-stringify-safe
npm http GET https://registry.npmjs.org/array-series/-/array-series-0.1.5.tgz
npm http 200 https://registry.npmjs.org/node-uuid
npm http GET https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz
npm http GET https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz
npm http GET https://registry.npmjs.org/bl/-/bl-1.0.0.tgz
npm http 200 https://registry.npmjs.org/form-data
npm http GET https://registry.npmjs.org/extend/-/extend-3.0.0.tgz
npm http 200 https://registry.npmjs.org/mime-types
npm http GET https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz
npm http 200 https://registry.npmjs.org/qs
npm http 200 https://registry.npmjs.org/tunnel-agent
npm http 200 https://registry.npmjs.org/http-signature
npm http 200 https://registry.npmjs.org/debug/-/debug-2.2.0.tgz
npm http 200 https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.1.tgz
npm http 200 https://registry.npmjs.org/oauth-sign
npm http 200 https://registry.npmjs.org/typpy/2.0.0
npm http 200 https://registry.npmjs.org/forever-agent/-/forever-agent-0.6.1.tgz
npm http 200 https://registry.npmjs.org/caseless/-/caseless-0.11.0.tgz
npm http GET https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz
npm http GET https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc3.tgz
npm http 200 https://registry.npmjs.org/flat-colors/-/flat-colors-3.0.0.tgz
npm http 200 https://registry.npmjs.org/tough-cookie
npm http 200 https://registry.npmjs.org/aws-sign2
npm http GET https://registry.npmjs.org/mime-types/-/mime-types-2.1.8.tgz
npm http 200 https://registry.npmjs.org/bl/-/bl-1.0.0.tgz
npm http 200 https://registry.npmjs.org/extend/-/extend-3.0.0.tgz
npm http GET https://registry.npmjs.org/qs/-/qs-5.2.0.tgz
npm http 200 https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz
npm http GET https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.2.tgz
npm http 200 https://registry.npmjs.org/array-series/-/array-series-0.1.5.tgz
npm http 200 https://registry.npmjs.org/stringstream
npm http 200 https://registry.npmjs.org/isstream
npm http 200 https://registry.npmjs.org/node-uuid/-/node-uuid-1.4.7.tgz
npm http GET https://registry.npmjs.org/http-signature/-/http-signature-1.1.0.tgz
npm http 200 https://registry.npmjs.org/form-data/-/form-data-1.0.0-rc3.tgz
npm http GET https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.0.tgz
npm http 200 https://registry.npmjs.org/combined-stream
npm http 200 https://registry.npmjs.org/mime-types/-/mime-types-2.1.8.tgz
npm http GET https://registry.npmjs.org/typpy/-/typpy-2.0.0.tgz
npm http GET https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.1.tgz
npm http GET https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz
npm http 200 https://registry.npmjs.org/x256/-/x256-0.0.2.tgz
npm http 200 https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.4.2.tgz
npm http 200 https://registry.npmjs.org/qs/-/qs-5.2.0.tgz
npm http 200 https://registry.npmjs.org/http-signature/-/http-signature-1.1.0.tgz
npm http 200 https://registry.npmjs.org/is-typedarray
npm http 200 https://registry.npmjs.org/oauth-sign/-/oauth-sign-0.8.0.tgz
npm http 200 https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.2.1.tgz
npm http GET https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz
npm http GET https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz
npm http 200 https://registry.npmjs.org/aws-sign2/-/aws-sign2-0.6.0.tgz
npm http GET https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz
npm http 200 https://registry.npmjs.org/typpy/-/typpy-2.0.0.tgz
npm http 200 https://registry.npmjs.org/hawk
npm http 200 https://registry.npmjs.org/har-validator
npm http GET https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz
npm http GET https://registry.npmjs.org/hawk/-/hawk-3.1.2.tgz
npm http GET https://registry.npmjs.org/har-validator/-/har-validator-2.0.3.tgz
npm http 200 https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.5.tgz
npm http 200 https://registry.npmjs.org/har-validator/-/har-validator-2.0.3.tgz
npm http 200 https://registry.npmjs.org/stringstream/-/stringstream-0.0.5.tgz
npm http 200 https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz
npm http 200 https://registry.npmjs.org/is-typedarray/-/is-typedarray-1.0.0.tgz
npm http 200 https://registry.npmjs.org/array-parallel
npm http 200 https://registry.npmjs.org/hawk/-/hawk-3.1.2.tgz
npm http GET https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm http 200 https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fetch failed https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm ERR! Error: EROFS, mkdir '/root/.npm/mime-types/2.1.8/package'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/.npm/mime-types/2.1.8/package
npm ERR! fstream_path /root/.npm/mime-types/2.1.8/package
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, utime '/root/tmp/npm-1634-C-HEMs+Y/1450317216932-0.8321770520415157/package/dist/qs.js'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-1634-C-HEMs+Y/1450317216932-0.8321770520415157/package/dist/qs.js
npm ERR! fstream_path /root/tmp/npm-1634-C-HEMs+Y/1450317216932-0.8321770520415157/package/dist/qs.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, open 'npm-debug.log'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path npm-debug.log
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, mkdir '/root/tmp/npm-1634-C-HEMs+Y/1450317217071-0.041094558546319604/package/lib/schemas'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-1634-C-HEMs+Y/1450317217071-0.041094558546319604/package/lib/schemas
npm ERR! fstream_path /root/tmp/npm-1634-C-HEMs+Y/1450317217071-0.041094558546319604/package/lib/schemas/index.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, utime '/root/tmp/npm-1634-C-HEMs+Y/1450317217035-0.7006595823913813/package/LICENSE.md'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-1634-C-HEMs+Y/1450317217035-0.7006595823913813/package/LICENSE.md
npm ERR! fstream_path /root/tmp/npm-1634-C-HEMs+Y/1450317217035-0.7006595823913813/package/LICENSE.md
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, open '/root/.npm/forever-agent/0.6.1/package/README.md'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/.npm/forever-agent/0.6.1/package/README.md
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, open '/root/tmp/npm-1634-C-HEMs+Y/1450317216887-0.3694995096884668/package/bower.json'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-1634-C-HEMs+Y/1450317216887-0.3694995096884668/package/bower.json
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, mkdir '/root/tmp/npm-1634-C-HEMs+Y/1450317217070-0.47894109692424536/package'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-1634-C-HEMs+Y/1450317217070-0.47894109692424536/package
npm ERR! fstream_path /root/tmp/npm-1634-C-HEMs+Y/1450317217070-0.47894109692424536/package
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, mkdir '/root/node_modules/image-to-ascii/node_modules/tmp/node_modules'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/node_modules/image-to-ascii/node_modules/tmp/node_modules
npm ERR! fstream_path /root/node_modules/image-to-ascii/node_modules/tmp/node_modules/os-tmpdir
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:171:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, mkdir '/root/.npm/caseless/0.11.0/package'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/.npm/caseless/0.11.0/package
npm ERR! fstream_path /root/.npm/caseless/0.11.0/package
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, utime '/root/tmp/npm-1634-C-HEMs+Y/1450317216999-0.2767476716544479/package/isstream.js'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-1634-C-HEMs+Y/1450317216999-0.2767476716544479/package/isstream.js
npm ERR! fstream_path /root/tmp/npm-1634-C-HEMs+Y/1450317216999-0.2767476716544479/package/isstream.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, utime '/root/tmp/npm-1634-C-HEMs+Y/1450317216942-0.9589869449846447/package/lib/signer.js'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-1634-C-HEMs+Y/1450317216942-0.9589869449846447/package/lib/signer.js
npm ERR! fstream_path /root/tmp/npm-1634-C-HEMs+Y/1450317216942-0.9589869449846447/package/lib/signer.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, utime '/root/tmp/npm-1634-C-HEMs+Y/1450317216967-0.4019896355457604/package/lib/cookie.js'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/tmp/npm-1634-C-HEMs+Y/1450317216967-0.4019896355457604/package/lib/cookie.js
npm ERR! fstream_path /root/tmp/npm-1634-C-HEMs+Y/1450317216967-0.4019896355457604/package/lib/cookie.js
npm ERR! fstream_type File
npm ERR! fstream_class FileWriter
npm ERR! fstream_finish_call utimes
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/writer.js:305:19
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, mkdir '/root/.npm/array-series/0.1.5/package'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/.npm/array-series/0.1.5/package
npm ERR! fstream_path /root/.npm/array-series/0.1.5/package
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! fstream_stack /usr/lib/nodejs/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/nodejs/mkdirp/index.js:37:53
npm ERR! fstream_stack Object.oncomplete (fs.js:107:15)
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! error rolling back Error: EROFS, unlink '/root/node_modules/image-to-ascii/node_modules/request'
npm ERR! error rolling back [email protected] { [Error: EROFS, unlink '/root/node_modules/image-to-ascii/node_modules/request']
npm ERR! error rolling back errno: 56,
npm ERR! error rolling back code: 'EROFS',
npm ERR! error rolling back path: '/root/node_modules/image-to-ascii/node_modules/request' }
npm ERR! error rolling back Error: EROFS, unlink '/root/node_modules/image-to-ascii'
npm ERR! error rolling back [email protected] { [Error: EROFS, unlink '/root/node_modules/image-to-ascii']
npm ERR! error rolling back errno: 56,
npm ERR! error rolling back code: 'EROFS',
npm ERR! error rolling back path: '/root/node_modules/image-to-ascii' }
npm ERR! Error: EROFS, chown '/root/.npm/aws-sign2/0.6.0/package.tgz'
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! path /root/.npm/aws-sign2/0.6.0/package.tgz
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! error rolling back Error: EROFS, unlink '/root/node_modules/image-to-ascii/node_modules/couleurs'
npm ERR! error rolling back [email protected] { [Error: EROFS, unlink '/root/node_modules/image-to-ascii/node_modules/couleurs']
npm ERR! error rolling back errno: 56,
npm ERR! error rolling back code: 'EROFS',
npm ERR! error rolling back path: '/root/node_modules/image-to-ascii/node_modules/couleurs' }
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! Error: EROFS, write
npm ERR! If you need help, you may report this log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]

npm ERR! System Linux 3.13.0-24-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "i" "image-to-ascii"
npm ERR! cwd /root
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code EROFS
npm ERR! errno 56
npm ERR! error rolling back Error: EROFS, unlink '/root/node_modules/image-to-ascii/node_modules/gm'
npm ERR! error rolling back [email protected] { [Error: EROFS, unlink '/root/node_modules/image-to-ascii/node_modules/gm']
npm ERR! error rolling back errno: 56,
npm ERR! error rolling back code: 'EROFS',
npm ERR! error rolling back path: '/root/node_modules/image-to-ascii/node_modules/gm' }
npm http GET https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm ERR! fetch failed https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm http 200 https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm http GET https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm ERR! fetch failed https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm http 200 https://registry.npmjs.org/array-parallel/-/array-parallel-0.1.3.tgz
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /root/npm-debug.log
npm ERR! not ok code 0

CLI tool for this module

Hey Ionica,

I'm super happy now I got a chance to use this module, so I wonder if there is anything like image-to-ascii-cli exists. Otherwise maybe we can create one to use it directly via CLI 😂

Better example explanation?

Hi!

I'd love to try out this program, alas I know little about JS. I tried to follow as closely as possible your instructions.

I managed to install it and I copy & pasted your example to a file named test.

Installing I got this message:

Is that OK?

I changed the example image to one that exists on my disk. Then I run node test and I get:

module.js:338
    throw err;
          ^
Error: Cannot find module '../lib/index'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/joseph/Desktop/test.js:1:82)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

What am I doing wrong? Obviously ../lib/index does not exist in my home, where is it located?

Thanks!

Using local file?

I havent found anything in the docs to use a local file, is this possible, and if so, how?

security issues

Hello,
due to one of your dependency, is your plugin marked as insecure,

Here is full report log

        "overview": "The debug module is vulnerable to regular expression denial of service when untrusted user input is passed into the `o` formatter. It takes around 50k characters to block for 2 seconds making this a low severity issue.",
        "recommendation": "Upgrade to version 2.6.9 or greater if you are on the 2.6.x series or 3.1.0 or greater.",
        "cvssVector": "CVSS:3.0/AV:N/AC:H/PR:N/UI:N/S:U/C:N/I:N/A:L",
        "cvssScore": 3.7,
        "module": "debug",
        "version": "2.2.0",
        "vulnerableVersions": "<= 2.6.8 || >= 3.0.0 <= 3.0.1",
        "patchedVersions": ">= 2.6.9 < 3.0.0 || >= 3.1.0",
        "title": "Regular Expression Denial of Service",
        "path": ["[email protected]", "[email protected]", "[email protected]", "[email protected]", "[email protected]"],
        "advisory": "https://nodesecurity.io/advisories/534"

Could you please upgrade your dependencies?

Thank you!

Cheers,
Andrej

Error: Stream yields empty buffer

I didn't know what happen. When i check gm and lwip library, it was available in dir, the installation process also no problem

Error: Stream yields empty buffer
at Socket. (C:\JS - Project\NodeJS basic\node_modules\gm\lib\command.js:57:17)
at Socket.emit (node:events:406:35)
at endReadableNT (node:internal/streams/readable:1331:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21),
Error: Command failed:
at ChildProcess.onExit (C:\JS - Project\NodeJS basic\node_modules\gm\lib\command.js:301:17)
at ChildProcess.emit (node:events:394:28)
at ChildProcess.cp.emit (C:\JS - Project\NodeJS basic\node_modules\cross-spawn\lib\enoent.js:40:29)
at maybeClose (node:internal/child_process:1067:16)
at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5) {
code: 3222601730,
signal: null
}

256 colors

It seems in my terminal, images only ever display with 16 colors, although my terminal is capable of 256.. Is this an issue with my terminal or a limitation of image-to-ascii? 256 color support would be amazing!

install failed cause lwip2

I run npm i --save image-to-ascii and got an error:

node scripts/install.js

Installing lwip. If this fails, just install GraphicsMagick (http://www.graphicsmagick.org/).
events.js:160
throw er; // Unhandled 'error' event
^

Error: spawn npm ENOENT
at exports._errnoException (util.js:1036:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:193:32)
at onErrorNT (internal/child_process.js:359:16)
at _combinedTickCallback (internal/process/next_tick.js:74:11)
at process._tickCallback (internal/process/next_tick.js:98:9)
at Module.runMain (module.js:592:11)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "D:\Program Files\nodejs\node.exe" "D:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "i" "--save" "image-to-ascii"
npm ERR! node v6.6.0
npm ERR! npm v3.10.3
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: node scripts/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node scripts/install.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lwip2 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs lwip2
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls lwip2
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\Code\npm-debug.log

and then run command npm i --save lwip2 got the same error message even through the proxy. some thing wrong with my setting?

Don't trim anything.

> console.log(cGithub)
< @@@@@@@@@@@                        @@@@        @@@@                    @@@@            
<     @@@@@@@@@@@@@@    @@@@@               @@@@@       @@@@                    @@@@            
<    @@@@@@              @@@@    @@@@@      @@@@@       @@@@                    @@@@            
<    @@@@@                       @@@@@      @@@@@       @@@@                    @@@@            
<   @@@@@               @@@@@  @@@@@@@@@@@  @@@@@       @@@@   @@@@@     @@@@   @@@@@@@@@@@@@   
<   @@@@@     @@@@@@@   @@@@@  @@@@@@@@@@@  @@@@@@@@@@@@@@@@   @@@@@     @@@@   @@@@@@@ @@@@@@  
<   @@@@@    @@@@@@@@@  @@@@@    @@@@@      @@@@@@@@@@@@@@@@   @@@@@     @@@@   @@@@      @@@@  
<   @@@@@        @@@@   @@@@@    @@@@@      @@@@@       @@@@   @@@@@     @@@@   @@@@      @@@@@ 
<    @@@@@       @@@@   @@@@@    @@@@@      @@@@@       @@@@   @@@@@     @@@@   @@@@      @@@@@ 
<    @@@@@@      @@@@   @@@@@    @@@@@      @@@@@       @@@@   @@@@@    @@@@@   @@@@      @@@@  
<     @@@@@@@@@@@@@@@@  @@@@@     @@@@@@@@  @@@@@       @@@@   @@@@@@@@@@@@@@   @@@@@@@@@@@@@@  
<         @@@@@@@@@@    @@@@@      @@@@@@@  @@@@        @@@@     @@@@@@@  @@@   @@@  @@@@@@@

Getting ascii escape codes for each color

I'm building an npm module that I'd like to display an image that I have processed into ASCII. However I don't want users to have to depend on any of the C/C++ image binaries. Is there a way this node module can produce the ASCII escape codes of the string so that I can print this to console manually stored.

Size of Screen printed

hi, nice job for this package !
can we adjust size of picture in console.log, my picture is so big ?

THanks

Stream version?

Can this accept an image stream so images can be created on the fly? Maybe I missed something along the way.

[WINDOWS] INSTALL ERROR

Hello, I have tryed installing this and this might not be used for windows but when i try installing it I have try so many ways but I always get this:
"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\steve\AppData\Roaming\npm-cache_logs\2017-10-02T00_49_13_732Z-debug.log
It seems like lwip failed to be intalled. Please check the errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node lib/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\steve\AppData\Roaming\npm-cache_logs\2017-10-02T00_49_16_321Z-debug.log
"

FULL INSTALL LOG: https://pastebin.com/tjL2k4P2

Is there anyway you can help me install this right?

What I have tryed:
Installed 64 bit
Installed 32 bit
Tryed: npm i -g image-to-ascii
Tryed: npm i -g image-to-ascii --msvs_version=2017
Using: npm i --save image-to-ascii it save at that location and for windows it don't work so I have to install it in %Appdata%

If this is not for windows please let me know.

Difference between image-to-ascii and cli?

dsc08890

Hi, I tried to convert above image using image-to-ascii and image-to-ascii-cli.

my code is as below.

const imageToAscii = require("image-to-ascii");
const pxs = ".`:,;'_^\"\\></-!~=)(|j?}{ ][ti+l7v1%yrfcJ32uIC$zwo96sngaT5qpkYVOL40&mG8*xhedbZUSAQ
PFDXWK#RNEHBM@";

imageToAscii("DSC08890.JPG",
  {pixels:pxs},
  (err, converted) => { console.log(err || converted); }
);

results are

screen shot 2016-06-03 at 4 49 15 pm

Would you let me know how can I produce ascii image like image-to-ascii-cli using image-to-ascii? What options do I need?
Thanks.

webcam.sh

@IonicaBizau this shell script will block process in Ubuntu when there is no such file /dev/video0 to open, which means the camera is not able to be called. So I will create a pull request for this problem.

ERROR when I npm install

See output

[email protected] install /Users/jonortiz/~github/mind-ctrl/node_modules/lwip2
node lib/install.js

Installing lwip. If this fails, just install GraphicsMagick (http://www.graphicsmagick.org/).
npm WARN deprecated [email protected]: This package is discontinued. Use lodash@^4.0.0.

[email protected] install /Users/jonortiz/~github/mind-ctrl/node_modules/lwip2/node_modules/lwip
node-gyp rebuild

CXX(target) Release/obj.target/lwip_decoder/src/decoder/init.o
CXX(target) Release/obj.target/lwip_decoder/src/decoder/util.o
CXX(target) Release/obj.target/lwip_decoder/src/decoder/buffer_worker.o
../src/decoder/buffer_worker.cpp:8:56: warning: ISO C++11 does not allow conversion from string literal to 'char *' [-Wwritable-strings]
_height(0), _channels(0), _trans(false), _metadata("") {
^
1 warning generated.
CXX(target) Release/obj.target/lwip_decoder/src/decoder/jpeg_decoder.o
CXX(target) Release/obj.target/lwip_decoder/src/decoder/png_decoder.o
CXX(target) Release/obj.target/lwip_decoder/src/decoder/gif_decoder.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jmemnobs.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jcomapi.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdapimin.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdapistd.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdatadst.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdatasrc.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdcoefct.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdcolor.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jddctmgr.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdhuff.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdinput.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdmainct.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdmarker.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdmaster.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdpostct.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdsample.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jerror.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jfdctflt.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jfdctfst.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jfdctint.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jidctflt.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jidctfst.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jidctint.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jutils.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jmemmgr.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdarith.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jdmerge.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jaricom.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jquant1.o
CC(target) Release/obj.target/lwip_decoder/src/lib/jpeg/jquant2.o
CC(target) Release/obj.target/lwip_decoder/src/lib/png/png.o
In file included from ../src/lib/png/png.c:14:
../src/lib/png/pngpriv.h:805:4: error: ZLIB_VERNUM != PNG_ZLIB_VERNUM "-I (include path) error: see the notes in pngpriv.h"

error ZLIB_VERNUM != PNG_ZLIB_VERNUM \

^
1 error generated.
make: *** [Release/obj.target/lwip_decoder/src/lib/png/png.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:125:13)
gyp ERR! stack at ChildProcess.emit (events.js:213:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Darwin 15.0.0
gyp ERR! command "/usr/local/Cellar/node/8.4.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jonortiz/~github/mind-ctrl/node_modules/lwip2/node_modules/lwip
gyp ERR! node -v v8.4.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/jonortiz/.npm/_logs/2017-09-16T22_22_44_792Z-debug.log
It seems like lwip failed to be intalled. Please check the errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node lib/install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:

Passing raw file contents of an image

Any tips for passing a raw image (in memory) to image-to-ascii?

I'd love to pass a string or file-like object, this only accepts the raw image in pixels or a path to a file (and I'd prefer not to have to write out temp files).

[Windows] Install error

npm ERR! code 7
npm ERR! path C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\lwip2
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node lib/install.js
npm ERR! Installing lwip. If this fails, just install GraphicsMagick (http://www.graphicsmagick.org/).
npm ERR! It seems like lwip failed to be intalled. Please check the errors.
npm ERR! npm WARN deprecated [email protected]: This package is discontinued. Use lodash@^4.0.0.
npm ERR! npm ERR! code 7
npm ERR! npm ERR! path C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\lwip2\node_modules\lwip
npm ERR! npm ERR! command failed
npm ERR! npm ERR! command C:\Windows\system32\cmd.exe /d /s /c node-gyp rebuild
npm ERR! npm ERR! gyp info it worked if it ends with ok
npm ERR! npm ERR! gyp info using [email protected]
npm ERR! npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! npm ERR! gyp info spawn C:\Python27\python.exe
npm ERR! npm ERR! gyp info spawn args [
npm ERR! npm ERR! gyp info spawn args 'C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\node-gyp\gyp\gyp_main.py',
npm ERR! npm ERR! gyp info spawn args 'binding.gyp',
npm ERR! npm ERR! gyp info spawn args '-f',
npm ERR! npm ERR! gyp info spawn args 'msvs',
npm ERR! npm ERR! gyp info spawn args '-G',
npm ERR! npm ERR! gyp info spawn args 'msvs_version=2015',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args 'C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\lwip2\node_modules\lwip\build\config.gypi',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args 'C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\node-gyp\addon.gypi',
npm ERR! npm ERR! gyp info spawn args '-I',
npm ERR! npm ERR! gyp info spawn args 'C:\Users\kelle\.node-gyp\14.16.1\include\node\common.gypi',
npm ERR! npm ERR! gyp info spawn args '-Dlibrary=shared_library',
npm ERR! npm ERR! gyp info spawn args '-Dvisibility=default',
npm ERR! npm ERR! gyp info spawn args '-Dnode_root_dir=C:\Users\kelle\.node-gyp\14.16.1',
npm ERR! npm ERR! gyp info spawn args '-Dnode_gyp_dir=C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\node-gyp',
npm ERR! npm ERR! gyp info spawn args '-Dnode_lib_file=C:\Users\kelle\.node-gyp\14.16.1\<(target_arch)\node.lib',
npm ERR! npm ERR! gyp info spawn args '-Dmodule_root_dir=C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\lwip2\node_modules\lwip',
npm ERR! npm ERR! gyp info spawn args '-Dnode_engine=v8',
npm ERR! npm ERR! gyp info spawn args '--depth=.',
npm ERR! npm ERR! gyp info spawn args '--no-parallel',
npm ERR! npm ERR! gyp info spawn args '--generator-output',
npm ERR! npm ERR! gyp info spawn args 'C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\lwip2\node_modules\lwip\build',
npm ERR! npm ERR! gyp info spawn args '-Goutput_dir=.'
npm ERR! npm ERR! gyp info spawn args ]
npm ERR! npm ERR! gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe
npm ERR! npm ERR! gyp info spawn args [
npm ERR! npm ERR! gyp info spawn args 'build/binding.sln',
npm ERR! npm ERR! gyp info spawn args '/clp:Verbosity=minimal',
npm ERR! npm ERR! gyp info spawn args '/nologo',
npm ERR! npm ERR! gyp info spawn args '/p:Configuration=Release;Platform=x64'
npm ERR! npm ERR! gyp info spawn args ]
npm ERR! npm ERR! gyp ERR! UNCAUGHT EXCEPTION
npm ERR! npm ERR! gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\15.0\Bin\MSBuild.exe ENOENT
npm ERR! npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:269:19)
npm ERR! npm ERR! gyp ERR! stack at onErrorNT (internal/child_process.js:465:16)
npm ERR! npm ERR! gyp ERR! stack at processTicksAndRejections (internal/process/task_queues.js:80:21)
npm ERR! npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! npm ERR! gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
npm ERR! npm ERR! gyp ERR! cwd C:\OpenServer\domains\justpro.local\CLI\nodejs\vktools\node_modules\lwip2\node_modules\lwip
npm ERR! npm ERR! gyp ERR! node -v v14.16.1
npm ERR! npm ERR! gyp ERR! node-gyp -v v3.8.0
npm ERR! npm ERR! gyp ERR! This is a bug in node-gyp.
npm ERR! npm ERR! gyp ERR! Try to update node-gyp and file an Issue if it does not help:
npm ERR! npm ERR! gyp ERR! https://github.com/nodejs/node-gyp/issues
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR! C:\Users\kelle\AppData\Local\npm-cache_logs\2021-05-12T22_43_46_117Z-debug.log

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\kelle\AppData\Local\npm-cache_logs\2021-05-12T22_43_46_372Z-debug.log

image
image

package broken.

package doesnt even wanna install, tried yarn and npm. other packages work

Promise support

It would be nice if image-to-ascii supported returning promises.

Expose original character / rgb values as generated

The values returned are perfect for consuming within a console, however for my project I needed the original character and rgb as generated.

Perhaps add a "pure data mode" boolean to the options and if so, add to an array structure instead of converting to final console string.

(Feature request)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.