A highly experimental project with the hermite image-resize algorithm implemented in WebGL. Due to mediocre performance and quality of canvas-resizing and javascript-based resize algorithms I implemented the hermite algorithm in WebGL.
Include the dist/hermite-resize-webgl.js
file and you are good to go.
// Pre-compile the program.
var glScale = GLScale({
width: 400,
height: 300
});
// Scale the input, can be string, image-elem or canvas.
glScale('/image.jpg', function(canvas) {
// canvas is enhanced with toBlob polyfill if not present.
canvas.toBlob(function(blob) {
});
});
After pre-compiling and loading the image, GLScale is up to 890% faster than the javascript version. (Tested on a Macbook Pro Retina 2012)
git clone
the project. Run npm install
and gulp
or gulp server
to start a static file server.
gulp
instead of from index.js (which should be for module including).