Skip to content
Advertisement

I want to change the color of an image inside a image in html5-canvas

I’m using canvas to make a badge. To draw the image I used the code :

JavaScript

The preview is like this.

canvas-image

Now, to color the images, I’ve tried using different blend modes. It works fine when I work it around for the background that is image. I tried to do it for the iconImage the same way, but it didn’t work. I want to color the icon in the middle without changing any other thing.

Advertisement

Answer

I was bored in the morning and makes this example for you in this example you can see all the elements in the canvas can be modified.

Note: Because of the CORS issue(Tainted canvases may not be exported), can’t edit the color of the external image here, so import your image using Choose File then change the image color!

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement