B
B
Bogdan2019-01-25 13:26:08
JavaScript
Bogdan, 2019-01-25 13:26:08

Rotate and crop image in Canvas?

Hello. Tell me please. How can I rotate and crop an image on Canvas so that it fills the entire area

Here is how in the example the lower and right areas did not fill from the photo
5c4ae41b5615d699898888.png
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
forspamonly2, 2019-01-27
@bogdan_uman

remember the school geometry course?
display a larger image so that it is enough for the cut out areas. by multiplying the original size according to the inscribed square formula by the root of two :)
https://codepen.io/anon/pen/NoNpzZ
and you can also calculate the minimum size and offset for each corner, but this is already a problem with an asterisk.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question