Getting started
Images
Path syntax
Media types and the canvas
Animation
Collisions and intersections
Paths
Text
Clearing the screen
Navigating along a path
Dragging path shapes images
Shadows
Charts diagrams
Polygons
Transformations
Responsive design
Compositing
Pixel manipulation
Contributors

Black White with "color"

suggest change

Remove color from an image via

ctx.globalCompositeOperation = 'color';

The amount of the effect can be controled with the alpha setting

// Render the image
ctx.globalCompositeOperation='source-atop';
ctx.drawImage(image, 0, 0);

// set the composite operation
ctx.globalCompositeOperation='color';
ctx.fillStyle = "white";
ctx.globalAlpha = alpha;  // alpha 0 = no effect 1 = full effect
ctx.fillRect(0, 0, image.width, image.height);

Feedback about page:

Feedback:
Optional: your email if you want me to get back to you:



Table Of Contents