pixelify-image

1.0.10 • Public • Published

pixelify-image

It is a JS module for pixelify multiple images. This can also be used for creating/previewing arduino matrix LED which uses an array of color codes as input.

You can have a pixelified image saved on your computer OR see the converted color code data OR check out how the matrix LED will look like using terminal.

Usage

With Installation

  • install the package
npm i pixelify-image
  • to use in your project
import { pixelify } from 'pixelify-image'

const { imagePixelContainer } = await pixelify('path/to/image.png', { width: matrixWidth, height: matrixHeight })

// imagePixelContainer contains an array of color codes and brightness/intensity in it

Without Installation

  • PLEASE keep in mind

    • BOTH "remote" and "local" path can be used with --convert-data && --convert-preview
    • ONLY "local" path can be used with --convert-save
  • To save the result image (LOCAL)

# The path coming after "default" must be an absolute path and it MUST be local
# It will create an output image in the same path of the input image
# the output image will be named as 'original image name' + '_pixelified.png'

npx pixelify-image --convert-save default '/Users/doehoonlee/Documents/Projects/Personal/img-pixelify/examples/HEART.png'

HEART_pixelified

  • To get the color codes
# Below example uses a remote image
# When using an image in local, the path following after "default" must be an absolute path
# Converted color codes can be used as input for arduino matrix LED

npx pixelify-image --convert-data default 'https://raw.githubusercontent.com/DOEHOONLEE/img-pixelify/main/examples/HEART.png'

convertData

  • To see/preview of a pixelified image or how it will look like on arduino matrix LED
npx pixelify-image --convert-preview default 'https://raw.githubusercontent.com/DOEHOONLEE/img-pixelify/main/examples/HEART.png'

Screen Shot 2023-01-05 at 9 05 00 PM

  • Multiple commands can be used with all commands
npx pixelify-image --convert-preview default 'https://raw.githubusercontent.com/DOEHOONLEE/img-pixelify/main/examples/HEART.png' 'https://raw.githubusercontent.com/DOEHOONLEE/img-pixelify/main/examples/pinkHeart.png' 'https://raw.githubusercontent.com/DOEHOONLEE/img-pixelify/main/examples/square.png'

multiple_output

Sample Arduino Matrix LED built with pixelify-image

heart

smile

Package Sidebar

Install

npm i pixelify-image

Weekly Downloads

0

Version

1.0.10

License

MIT

Unpacked Size

121 kB

Total Files

7

Last publish

Collaborators

  • doehoonlee