Skip to content

dasilvacontin/imgdye

Repository files navigation

imgdye

Tint PNG images using Javascript – very useful for projects/games using HTML5 Canvas.

Install

$ npm install --save imgdye

Usage

var imgdye = require('imgdye')

// imgdye returns a buffer containing the testImage with a 70% opacity #33CC33 color overlay
var testImage = document.querySelector('.avatar')
var dyedTestImage = imgdye(testImage, '#33CC33', 0.7)

// Use the buffer to draw the tinted image on a canvas
ctx.drawImage(dyedTestImage, 0, 0)

Here's a simple test sample using the function: http://bluecodestudio.com/CanvasDye/test.html

License

MIT © David da Silva

About

🎨 Tint PNG images using JavaScript.

Resources

Stars

Watchers

Forks

Packages

No packages published