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
- BOTH "remote" and "local" path can be used with
-
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'
- 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'
- 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'
- 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'