Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.0.0—Modularize all the things, GraphicsMagick is optional, (better) Windows support #25

Merged
merged 17 commits into from
Mar 8, 2016

Conversation

IonicaBizau
Copy link
Owner

I have been working on this new major release since September, last year. It was a huge work to break, split and modularize the previous code. 😅

GraphicsMagick is still recommended to be installed on the system, but in case if it's not installed, the library will compile lwip—a nice Node.js image processor. ✨

After upgrading to couleurs@6.0.0 we got a better Windows support—in fact, this library is now compatible with the 16 colors from the Windows command prompt. Pretty cool, eh? 😁

I refactored the code base from scratch. I used ES2015 features which means you should run this using Node.js >= 4.0.0.

Another nice feature is that you can use an existing image buffer as input. Using an url or local path works too. 💫 Fixes #24.

Few other features are the new options that I added: custom/transparent background (defaults to white), custom stringify function etc. They are documented in the README.md file. 📝

By turning off the concat and stringify options we will get an object back (not a string). This allows us to modify the image before stringifying it. Fixes #17.


Linux Version

Windows Version

I split the monolithic structure that was here before in small reusable modules that are dependencies of this library. If someone is interested to see how the dependencies graph looks like, there you go:

  • image-to-ascii—A Node.JS module that converts images to ASCII art.
    • asciify-pixel-matrix—Asciifies a matrix of pixels.
      • asciify-pixel—Asciifies a pixel object.
        • couleurs—Add some color and styles to your Node.JS strings.
          • ansy—Cross platform ANSI colors made easy.
            • custom-return—Generate a function that returns a constant.
              • noop6—No operation as a module using an arrow function.
        • ...
    • pixel-bg—Change the pixel background color.
    • pixel-class—A tiny class for pixel manipulation.
    • pixel-white-bg—Set white background color for a pixel.
    • compute-size—Helper tool for resizing the things.
    • image-parser—An image parser that works.
      • err—A tiny library to create custom errors in JavaScript.
        • typpy—A better typeof for JavaScript.
      • gm-tools—Friendly tools for interacting with GraphicsMagick.
        • ...
      • lwipify—Convert images in lwip objects.
        • lwip2—A friendlier wrapper around the lwip library.
        • url-remote—Checks if a given url is a remote url or not.
          • url-local—Checks if a given url is a local url or not.
            • parse-url—An advanced url parser supporting git urls too.
              • is-ssh—Check if an input value is a ssh url or not.
                • protocols—Get the protocols of an input url.
      • pixel-class—A tiny class for pixel manipulation.
        • deffy—Small and fast library to set default values.
          • typpy—A better typeof for JavaScript.
    • imgpx
      • lwip-pixels
        • pixel-class—A tiny class for pixel manipulation.
          • deffy—Small and fast library to set default values.
            • typpy—A better typeof for JavaScript.
      • lwipify—Convert images in lwip objects.
        • ...
    • one-by-one
      • deffy—Small and fast library to set default values.
        • typpy—A better typeof for JavaScript.
        • ...
    • terminal-char-width
      • ...
    • ul—A minimalist utility library.
      • deffy—Small and fast library to set default values.
      • typpy—A better typeof for JavaScript.

@rgbkrk
Copy link
Contributor

rgbkrk commented Mar 7, 2016

I used ES2015 features which means you should run this using Node.js >= 4.0.0.

game on for us!

love the Windows support

@IonicaBizau
Copy link
Owner Author

game on for us!

What does that mean? Is it something good? 😄

love the Windows support

Maybe one day Microsoft will switch from 16 colors to 16 million colors in Command Prompt. 😂

@rgbkrk
Copy link
Contributor

rgbkrk commented Mar 7, 2016

What does that mean? Is it something good? 😄

Yes! The project I'm using this in requires node 4+. The phrase "game on" in this context means that "we're good to go, let's do this."

Maybe one day Microsoft will switch from 16 colors to 16 million colors in Command Prompt. 😂

Is it different in PowerShell?

@IonicaBizau
Copy link
Owner Author

Is it different in PowerShell?

I have no idea. Just try it. Basically it's smart enough to get the best compatibility: 16 million colors (true color), 256 colors, 16 colors, no color at all. 😁

@rgbkrk
Copy link
Contributor

rgbkrk commented Mar 7, 2016

Ah, k. Cool!

@yowakita
Copy link

yowakita commented Mar 7, 2016

This is awesome, I definitely wanna play around with this this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Passing raw file contents of an image Expose original character / rgb values as generated
3 participants