Can I recolor an image using JavaScript?

I was wondering if anyone knows of a way to recolor an image using JavaScript. Any type of image pixel access would work, I suppose, as long as I could read / write color values. It should work in Firefox; if it does not work in IE, it does not really matter, but it would be useful if that were the case.

Thank you for your help!

+3
source share
4 answers

You can change the image using the canvas.

. , - .

+6

alex- (: <canvas>, - IE cough), JS, , , . " ", (: PHP GD).

+2

The usual way to change the displayed images on the fly is to have duplicate images in each of the colors you want, and then use javascript or CSS to replace them.

0
source

you can also do something like http://jsfiddle.net/xewbP/ , although you are not sure that you can discolor colors like this

0
source

Source: https://habr.com/ru/post/1766112/


All Articles