Package Exports
- image-brightness
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (image-brightness) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
image-brightness
Small library to apply a brightness transformation to a image.
Install
npm install image-brightness --saveUsage
At the moment there are two ways of usage, you either provide a image or you provide a canvas imageData.
From image:
JS file:
var imageBrightness = require('image-brightness');
imageBrightness({
from: '#original',
to: '#target-1',
adjustment: 30
});HTML:
<img id="original" src="http://lorempixel.com/400/200" />
<div id="target-1"></div>From canvas imageData:
var imageBrightness = require('image-brightness');
var canvas = document.createElement('canvas');
var context = canvas.getContext('2d');
var img = new Image;
img.onload = function(){
context.drawImage(img,0,0);
var imageData = context.getImageData(0, 0, img.width, img.height);
var result3 = imageBrightness({
imageData: imageData,
to: '#target-3',
adjustment: 30
});
var result4 = imageBrightness({
imageData: imageData,
to: '#target-4',
adjustment: 70
});
};
img.src = "http://lorempixel.com/400/200";From image url:
var imageBrightness = require('image-brightness');
imageBrightness({
url: "http://lorempixel.com/400/200",
to: '#target-5',
adjustment: 30
});