imagelib

0.0.1 • Public • Published

imageLib.js

Module for processing and manipulation images on pure JavaScript

Example

var imageLib = require('./imageLib.js');

imageLib(200, 200).create(function() {
    var x, y;

	for(x=20; x < 180; x++) {
		for(y=20; y < 40; y++) {
			this.setPixel(x, y, 255, 0, 0, 255); // black
		}
	}
	
	for(y=0; y < this.height; y++) {
		this.setPixel(0, y, 255, 0, 0, 255);
		this.setPixel(this.width-1, y, 255, 0, 0, 255);
	}

	for(x=0; x < this.width; x++) {
		this.setPixel(x, 0, 255, 0, 0, 255);
		this.setPixel(x, this.height-1, 255, 0, 0, 255);
	}
	
	this.toPng('./images/simple.png');
	this.toJpeg('./images/simple.jpg');
});

API

constructor(mixed first_argument[, int second_argument])

create(function callback)

jpegToData(function callback)

bmpToData(function callback)

pngToData(function callback)

array getPixel(int x, int y)

setPixel(int x, int y, int r, int g, int b, int a)

resize(int width, int height[, boolean interpolation])

pasteTo(resourse toImage, int x, int y[, boolean blending])

toPng(string file[, function callback])

toJpeg(string file[, function callback, [int quality]])

Readme

Keywords

Package Sidebar

Install

npm i imagelib

Weekly Downloads

1

Version

0.0.1

License

MIT

Last publish

Collaborators

  • lampa