Skip to content

LinusU/rotate-image-data

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 pixels
  • height: Number - The height of the image, in pixels
  • data: Buffer | TypedArray - The image data, stored as raw pixel data in the RGBA order

Returns an ImageData instance.

Related

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published