D
D
Daniil Popov2018-03-08 12:19:10
JavaScript
Daniil Popov, 2018-03-08 12:19:10

How to round the corners of an image on canvas?

Are there built-in methods for rounding the edges of an image in JS (similar to border-radius in css) when displaying an image on a canvas? What ready implementations of similar you met?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
T
twobomb, 2018-03-08
@groog

Here I wrote a function for rounding pictures, similar to drawImage. Only the first parameter is context , and the last is the round radius. Here an example .

O
Oleg, 2018-03-08
@politon

mask
context.clip()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question