README
Perra
JavaScript Image Processing library for Node.js and Browsers. TypeScript support. Pure JavaScript implementation and TypeScript Definitions generated automatically Bitmap haxe library.
Contents
Summary
- VERY WIP
- Generated automatically Bitmap haxe library.
- This is a Zero implementation package, only declare types and implements Some tests.
- See Bitmap - It has the same API and features.
- Both JavaScript library bundle file and TypeScript definitions automatically generated.
Install
npm install perra
API Reference
- The API and features are the same as Bitmap.
Usage
This section show the basic API of the library.
Since API and features the same as Bitmap check there for details and API while here there's is none.
Read and write images from file system
(Node.js only)
import { IOUtil, PNGBitmap, Color, BitmapIO } from 'perra'
(async ()=>{
var bitmap = PNGBitmap.create(IOUtil.readFile('input.png'))
bitmap.draw.rectangle2(10, 10, 30, 30, Color.create(20, 200, 10, 128), true)
BitmapIO.writeBitmap('out.png', bitmap)
})()
Fetching images from URL
(Node.js and Browser)
(in node.js URLs must be absolute while in browsers fetching from external servers needs to support CORs requests)
import { bitmap as P } from 'perra'
var url = 'https://cancerberosgx.github.io/demos/magica/images/parrots_orig.png';
P.IOUtil.fetch(url, async (err , data) => {
if (err != null) {
console.error('Error reading image ', err)
return
}
var bitmap = bitmap.PNGBitmap.create(data)
})
Loading images from HTMLInputElement, HTMLCanvasElement, HTMLImageElement
(Browser only)
TODO
Rendering in HTMLCanvasElement, HTMLImageElement
(Browser only)
TODO
Status / TODO / Road map / Changelog
See TODO.md