Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

canvas rounded corners on image

ctx.save();
ctx.beginPath();
// use lineTo and BezierTo here to make the path you want, which is a rectangle the size of the image with two rounded corners.
ctx.closePath();
ctx.clip();

// draw the image using  ctx.drawImage(..
ctx.restore(); // so clipping path won't affect anything else drawn afterwards
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #canvas #rounded #corners #image
ADD COMMENT
Topic
Name
5+6 =