image-filter-sepia
Advanced tools
Comparing version 0.0.1 to 0.0.2
14
index.js
@@ -42,2 +42,11 @@ /** | ||
return imageData; | ||
} | ||
/** | ||
* @name convertToDataURL | ||
* @param {object} canvas | ||
* @param {object} context | ||
*/ | ||
function convertToDataURL(canvas, context, imageData) { | ||
context.putImageData(imageData, 0, 0); | ||
@@ -52,2 +61,3 @@ return canvas.toDataURL(); | ||
* @param {string} options.contrast - contrast value to apply | ||
* @param {bool} options.asDataURL | ||
*/ | ||
@@ -71,3 +81,7 @@ module.exports = function sepia(options) { | ||
if (options.asDataURL) { | ||
return convertToDataURL(canvas, context, result); | ||
} | ||
return result; | ||
} |
{ | ||
"name": "image-filter-sepia", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Small library to apply a sepia filter to a image", | ||
"main": "index.js", | ||
"scripts": { | ||
"build": "browserify sandbox/sandbox.js > sandbox/bundle.js" | ||
"build": "browserify sandbox/sandbox.js > sandbox/bundle.js", | ||
"serve": "http-server sandbox" | ||
}, | ||
@@ -21,2 +22,6 @@ "author": "Ricardo Canastro", | ||
"image-sepia", | ||
"filter", | ||
"filters", | ||
"processing", | ||
"manipulation", | ||
"sepia", | ||
@@ -27,4 +32,5 @@ "transformation", | ||
"devDependencies": { | ||
"browserify": "^13.0.0" | ||
"browserify": "^13.0.0", | ||
"http-server": "^0.9.0" | ||
} | ||
} |
@@ -14,2 +14,4 @@ # image-sepia | ||
The default operation of this library is to consume imageData and return transformed imageData, but to facilitate a bit you can pass `asDataURL` as true to return a dataURL that you can inject into a image tag. | ||
JS file: | ||
@@ -20,3 +22,4 @@ ```js | ||
var result = imageFilterSepia({ | ||
data: IMAGE_DATA | ||
data: IMAGE_DATA, | ||
asDataURL: true //if you want data to data transformation you don't need to include this | ||
}); | ||
@@ -23,0 +26,0 @@ ``` |
@@ -27,7 +27,8 @@ var imageFilterSepia = require('../index'); | ||
var results1 = imageFilterSepia({ | ||
data: data | ||
data: data, | ||
asDataURL: true | ||
}); | ||
applyResults('#target-1', results1); | ||
}; | ||
img.src = "http://lorempixel.com/400/200"; | ||
img.src = "dummy.jpg"; | ||
} |
Sorry, the diff of this file is not supported yet
53656
7
98
58
2