1.0.1 • Published 2 years ago

pixel-shop v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
2 years ago

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 })

appendix

Reference docs

Reading image data in Node

Reading image data in the browser