npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

chalk-image

v1.0.3

Published

Convert images (currently jpeg,png) into chalk.js code

Downloads

10

Readme

Chalk Image Converter

Important note!: The format of the options available for chalk-image has changed (they're actually easier now! You're welcome). Please make sure you read the new options format if your app breaks!


About:

Convert your images into console-code with Chalk!


Examples:

Input:

Kurt Cobain

Output:

ci.drawImg('somePicture.jpg',{}) Kurt Cobain, drawn in classic mode

Full Color Output

ci.drawImg('somePicture.jpg',{colMode:'16m'}) Kurt Cobain, drawn in full color mode


Instructions:

Just include your chalk-image: const ci = require('chalk-image');

Then draw!: ci.drawImg('path/to/my/img.jpg');

Or export a promise!: ci.drawImage('path/to/my/img.jpg',{exportMe:true}).then(...//do magic) Works best with BMPs and JP(E)Gs!


Options:

There are a number of options available. These are passed to .drawImg() as a secondary optional options object. The properties of this object are as follows:

  • exportMe: Default false. If true, .drawImg() will return a .thenable promise. Otherwise, .drawImg() will simply draw the image when it's finished mathing it. NOTE: Even without a promise, .drawImg(), will not simply return the image string (so don't try doing const myImage = chalkImage.drawImg('somefile). It won't work). This is because the drawing process involves some asynchronous wizardry.
  • verbose: Default false. If true, you'll get some extra info about the image (and console) dimensions. Useful if you wanna debug stuff.
  • colMode: Default no value. If set to 16 or 16m, will draw in 16-million color mode. If set to 256, will draw in 256-color mode. Otherwise, It'll draw in good-old-fashioned 16 color mode.

Tests:

Go ahead and cd into the 'tests' folder. I've stuck a separate readme in there too, just to make things nice and easy.


Issues:

  1. Does not currently work with animated GIFs. This for a number of reasons. Firstly, GIFs are not necessarily stored in individual, separate frames. If part of an animated GIF doesn't change, that part may not necessarily be 'part' of each new frame. Second, the amount of data for animated gifs is actually rather huge (a 100x100, 3 second GIF, with 256 colors at 30FPS, is potentially 2.3 billion separate numbers)! Finally, while there are methods to clear individual pixels in the console, none of them are terribly quick or efficient.
  2. ~~There's a bit of an issue with certain combinations of image dimensions and console dimensions, where the resulting image 'rows' end up overflowing. This in turn results in heavily distorted images. If you can help fix it, feel free to submit a pull request.~~ Nevermind, this should be fixed!
  3. Full color should work on all systems. However, until recently, Windows systems (or ChalkJS?) didn't support color. Be warned that YMMV.
  4. Why Kurt Cobain? Because I searched for "high-contrast image" in Google, and that was the first picture that came up. So there.

Credits: