8Bit is a javascript module that converts an image into a pixelated version using canvas.
You can find a demo here.
npm install 8bit
bower install 8bit
<script type="text/javascript" src="https://cdn.rawgit.com/rogeriopvl/8bit/master/8bit.js"></script>
var eightBit = require('8bit'); // only needed for NPM installs
var img = new Image();
img.onload = function () {
eightBit(document.getElementById('mycanvas'), img, 10);
};
img.src = 'http://foobar.com/your_image.png';
eightBit(canvas, image, scaleFactor)
canvas
- canvas element that will be used to place the pixelated version of the imageimage
- image HTMLElement to pixelatescaleFactor
- Number between 0 and 100, lower is more pixelated.
MIT (see LICENSE file)