Pour mettre une image de fond ("background image") dans un canvas sous HTML5
il existe plusieurs solutions le plus simple est d'utiliser l'attribut background: url(image.png) dans la balise canvas. Illustration:

<!DOCTYPE html><html><body><canvas id="tools_sketch" width="512" height="512"style="background: url(lena.png) no-repeat center center;border:10px solid #000000;"></canvas></body></html>
on peut aussi passer par javascript pour tracer l'image de fond.
Recherches associées
| Liens | Site |
|---|---|
| How to set the background image of a html 5 canvas to .png image | stackoverflow |
| HTML5 Canvas background image | stackoverflow |
| HTML5 Canvas Image Tutorial | stackoverflow |
| jsfiddle exemple | jsfiddle |
| Using HTML5 canvas to make a generative background | stackoverflow |
| HOW DO YOU DRAW AN IMAGE ON HTML5 CANVAS? | williammalone |
| code | w3schools |
| Resizing an image in an HTML5 canvas | stackoverflow |
| HTML canvas getImageData() Method | w3schools |
| HTML5 Canvas Image Size Tutorial | html5canvastutorials |
| CSS background Property | w3schools |
