D
D
dpablo_escobarr2020-12-12 19:15:08
JavaScript
dpablo_escobarr, 2020-12-12 19:15:08

Is it possible to crop an image using Canvas?

imagine that this picture is in the canvas. is it possible to get only the part of the image that is inside the given rhombus? 5fd4ec85395e8020499022.jpeg
a small clarification - without libraries, if they exist, I don't know

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
dollar, 2020-12-12
@dollar

Of course you can .
The elegance of the implementation depends on the specific task. For example, if you just need to hide a part outside the contour, and at the same time the contour is always the same, then you can do without canvas at all - just overlay a picture with transparency in the center from above.
And if the user himself cuts out the contour with the mouse, then this is already some kind of online graphic editor. Difficult task.
As a last resort, you can always copy pixel by pixel.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question