How can I go about cropping a HTML canvas around only it’s content?
I am using strokeText to fill the canvas so it is difficult to compute the size of the content. Can I iterate over every pixel of the canvas, or is there something better?
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use measureText in advance to check how much space is taken by the text. I hope that answers your question.