pixel-mosaic
v1.0.1
Published
Pixelate the Image
Downloads
4
Readme
🚀 Npm-Pixel-Mosaic
1. Installation
npm i pixel-mosaic
2. Loading
import Mosaic from "pixel-mosaic"
3. Usage
const mosaic = new Mosaic(options)
- options
src <string><required>
- The resource address of the image
nw<number>
- Pixelation degree of x-axis(Unit: percentage)
- The value should be less than 100
- default: 25
nh<number>
- Pixelation degree of y-axis(Unit: percentage)
- The value should be less than 100
- default: 25
4. Example
import Mosaic from "pixel-mosaic"
const src = require("./assets/123.png")
const mosaic = new Mosaic({
src,
nw: 3.15,
nh: 3.15,
})
document.body.appendChild(mosaic.canvas)