0.1.0 • Published 3 years ago
rotate-image-data v0.1.0
Rotate Image Data
Rotate a decoded raw image.
Note: Currently only 180 degrees rotation is implemented.
Installation
npm install --save rotate-image-data
Usage
const rotateImageData = require('rotate-image-data')
const result = rotateImageData(image, 180)
console.log(result.width)
//=> 128
console.log(result.height)
//=> 256
console.log(result.data)
//=> Uint8ClampedArray [ ... ]
API
rotateImageData(image, degrees)
Rotate the image with the supplied number of degrees.
The image
argument should be a ImageData
instance, or any object with the following properties:
width: Number
- The width of the image, in pixelsheight: Number
- The height of the image, in pixelsdata: Buffer | TypedArray
- The image data, stored as raw pixel data in the RGBA order
Returns an ImageData
instance.
Related
resize-image-data
- Resize a decoded raw image
0.1.0
3 years ago