
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
image-ascii-art
Advanced tools
This is a simple web package that converts an input image to ascii art.
It works on desktop and mobile as well, there is one demo you can find at the link below:
The source code of the demo is available on GitHub:
This demo show you how to load a default image and how to load an image from your computer to convert it to ascii art.
I also made a video stream version.
The source code of the examples is available on GitHub:
You can install it by typing the following command in your terminal:
npm install image-ascii-art
or
yarn add image-ascii-art
To use the package, you need to import it into your project:
import {ImageAscii} from "image-ascii-art";
Then you can create use the Component like this in Typescript/JavaScript:
<ImageAscii
image={image!}
parentRef={parentRef}
artType={ArtTypeEnum.ASCII_COLOR_BG_IMAGE}
charsPerLine={charsPerLine}
charsPerColumn={charsPerColumn}
fontColor={'white'}
backgroundColor={'black'}
/>
You can also pass a pre tag reference to the component, so it can be used to get the ASCII text:
<ImageAscii
image={image!}
parentRef={parentRef}
artType={ArtTypeEnum.ASCII_COLOR_BG_IMAGE}
charsPerLine={charsPerLine}
charsPerColumn={charsPerColumn}
fontColor={'white'}
backgroundColor={'black'}
preTagRef={preTagRef}
/>
To use the component, you need to pass the following props:
image
- The input HTMLImageElement.parentRef
- The reference of the parent element, to fit the ascii art in it.artType
- The type of the ascii art, you can choose between ASCII
, ASCII_COLOR
and ASCII_COLOR_BG_IMAGE
.charsPerLine
- The number of characters per line.charsPerColumn
- The number of characters per column.fontColor
- The color of the font.backgroundColor
- The color of the background.preTagRef
- The reference of the pre tag, to get the ascii art text.The parentRef
is used to fit the ascii art in the parent element, so you need to pass the reference of the parent
element like a div
, you can check the example to see how to use it.
Warning
Be careful when using this package, the image must be loaded before enabling the Image Ascii component, otherwise it will not work. If you want to set the ascii art with a correct aspect ratio, follow the example at the link below: Image Ascii Art
The artType
is used to choose the type of the ascii art, you can choose between ASCII
, ASCII_COLOR
and ASCII_COLOR_BG_IMAGE
.
ASCII
- The ascii art will be defined only by two colors the font color and the background color. (which you can set
with the props fontColor
and backgroundColor
).ASCII_COLOR
- The ascii art will be printed with each character having the color of the pixel it represents (it is
an extensive mode, you should use the ASCII_COLOR_BG_IMAGE
mode instead).ASCII_COLOR_BG_IMAGE
- The ascii art will be printed with color using the original image as background for the color
of the characters, you should use this mode if you want good performance instead of the ASCII_COLOR
mode.Note Be sure to import the enum
ArtTypeEnum
from the package, to use it in your code.
The code style used in this project is XO.
You can find some changes in the .eslintrc.js
file.
The project is also set up to use ESLint.
The project is set up to run the following actions:
Xo:
https://github.com/xojs/xo
ESLint:
https://eslint.org/docs/latest/user-guide/getting-started
GitHub gh-pages:
https://github.com/gitname/react-gh-pages
Quentin MOREL :
FAQs
Convert image to ascii art
The npm package image-ascii-art receives a total of 2 weekly downloads. As such, image-ascii-art popularity was classified as not popular.
We found that image-ascii-art demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.