1.0.1 • Published 3 years ago
pixel-shop v1.0.1
Pixel shop
Transform images; given pixel data, width, and height.
Transforms:
rotateImageCCW
- rotates pixel values to match a counter-clockwise 90º rotation (also returns updated width and height values)invertColors
- invert the RGB values of RGBA pixel data (no alpha change)
Usage
For use with ImageData pattern (Uint8ClampedArray, width, height)
Returns { data: (Uint8ClampedArray), width: (number), height: (number) }
For node, read files using image-pixels or get-pixels
import { rotateImageCCW, invertColors } from 'pixel-shop'
import pixels from "image-pixels";
// example image data:
let {data, width, height } = await pixels('example.jpg');
const rotatedExample = rotateImageCCW({ data, width, height });
const invertedColorExample = invertColors({ data, width, height })