GithubHelp home page GithubHelp logo

syzer / img2ascii Goto Github PK

View Code? Open in Web Editor NEW
20.0 5.0 3.0 391 KB

Convert image url to ascii art

JavaScript 100.00%
ascii-art ascii image-processing converter much-wow image-converter giphy gif png jpeg

img2ascii's Introduction

img2ascii

Greenkeeper badge

NPM Version Dependency Status Downloads Today Downloads Month Build Status

Purpose

  • Downloads images (jpeg/gif/png) and outputs them in your console.
  • Make custom ssh login message for your users.
  • Picture is worth thousands words.. we will use both!

Doge In terminal

Getting Started

brew install graphicsmagick
npm install -g img2ascii

Usage CLI

Usage: img2ascii [url|file] --cols [num] --ratio [num]

Options:
  -c, --cols   Number of columns in terminal                       [default: 80]
  -r, --ratio  Aspect ratio. Try 0.5 to flatten image
               and 2 to lengthen image                              [default: 1]

Examples

img2ascii doge.png
img2ascii https://pbs.twimg.com/profile_images/378800000822867536/3f5a00acf72df93528b6bb7cd0a4fd0c.jpeg
img2ascii doge.png --cols 20 --ratio 0.5

Usage as module

const img2ascii = require('img2ascii')({
    img: './assets/snafu.gif',
    cols: 90,                   // optional
    ratio: 1.2                  // optional
}).pipe(process.stdout)

img2ascii's People

Stargazers

 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

img2ascii's Issues

Getting 'Error: spawn gm ENOENT'

When trying to run img2ascii I get an error, this is the case for web as well as local resources.

E.g.

img2ascii http://media.caranddriver.com/images/15q2/657948/2015-tesla-model-s-70d-instrumented-test-review-car-and-driver-photo-658384-s-original.jpg -c 80

Output:

events.js:141
      throw er; // Unhandled 'error' event
      ^

Error: spawn gm ENOENT
    at exports._errnoException (util.js:874:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at doNTCallback2 (node.js:441:9)
    at process._tickCallback (node.js:355:17)
    at Function.Module.runMain (module.js:469:11)
    at startup (node.js:136:18)
    at node.js:963:3

Information:
OS: Mac OS X 10.11.3 (El Capitan) - MacBook Pro '14
Node: v4.2.3
NPM: 3.5.2

Action required: Greenkeeper could not be activated 🚨

🚨 You need to enable Continuous Integration on all branches of this repository. 🚨

To enable Greenkeeper, you need to make sure that a commit status is reported on all branches. This is required by Greenkeeper because we are using your CI build statuses to figure out when to notify you about breaking changes.

Since we did not receive a CI status on the greenkeeper/initial branch, we assume that you still need to configure it.

If you have already set up a CI for this repository, you might need to check your configuration. Make sure it will run on all new branches. If you don’t want it to run on every branch, you can whitelist branches starting with greenkeeper/.

We recommend using Travis CI, but Greenkeeper will work with every other CI service as well.

Version 10 of node.js has been released

Version 10 of Node.js (code name Dubnium) has been released! 🎊

To see what happens to your code in Node.js 10, Greenkeeper has created a branch with the following changes:

  • Added the new Node.js version to your .travis.yml

If you’re interested in upgrading this repo to Node.js 10, you can open a PR with these changes. Please note that this issue is just intended as a friendly reminder and the PR as a possible starting point for getting your code running on Node.js 10.

More information on this issue

Greenkeeper has checked the engines key in any package.json file, the .nvmrc file, and the .travis.yml file, if present.

  • engines was only updated if it defined a single version, not a range.
  • .nvmrc was updated to Node.js 10
  • .travis.yml was only changed if there was a root-level node_js that didn’t already include Node.js 10, such as node or lts/*. In this case, the new version was appended to the list. We didn’t touch job or matrix configurations because these tend to be quite specific and complex, and it’s difficult to infer what the intentions were.

For many simpler .travis.yml configurations, this PR should suffice as-is, but depending on what you’re doing it may require additional work or may not be applicable at all. We’re also aware that you may have good reasons to not update to Node.js 10, which is why this was sent as an issue and not a pull request. Feel free to delete it without comment, I’m a humble robot and won’t feel rejected 🤖


FAQ and help

There is a collection of frequently asked questions. If those don’t help, you can always ask the humans behind Greenkeeper.


Your Greenkeeper Bot 🌴

Rows optically too high (stretched image)

Great lib!

Although the rows and cols are exactly the same, the resulting images look higher because the height of a row is much higher than the width of a col.

For example this picture
favicon

Gets converted into:
enrise-ascii

Is there a way to adjust this?

Display warning if graphicsmagic is not present

img2ascii someImage.jpg
Error: Error: Incomplete or corrupt PNG file
    at new PNG (/home/ubuntu/.nvm/versions/node/v9.11.1/lib/node_modules/img2ascii/node_modules/png-js/png-node.js:140:17)
    at /home/ubuntu/.nvm/versions/node/v9.11.1/lib/node_modules/img2ascii/node_modules/picture-tube/index.js:18:19
    at Stream.a.end (/home/ubuntu/.nvm/versions/node/v9.11.1/lib/node_modules/img2ascii/node_modules/event-stream/index.js:78:5)
    at Stream.thepipe.(anonymous function) [as end] (/home/ubuntu/.nvm/versions/node/v9.11.1/lib/node_modules/img2ascii/node_modules/event-stream/index.js:329:27)
    at PassThrough.onend (_stream_readable.js:607:10)
    at Object.onceWrapper (events.js:272:13)
    at PassThrough.emit (events.js:180:13)
    at endReadableNT (_stream_readable.js:1106:12)
    at process._tickCallback (internal/process/next_tick.js:178:19)

Not working without graphicmagick

vents.js:154
throw er; // Unhandled 'error' event
^

Error: spawn gm ENOENT
at exports._errnoException (util.js:856:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
at onErrorNT (internal/child_process.js:344:16)
at nextTickCallbackWith2Args (node.js:475:9)
at process._tickCallback (node.js:389:17)
at Function.Module.runMain (module.js:449:11)
at startup (node.js:140:18)
at node.js:1001:3

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.