I want to add text on an image using HTML5. How can this be done?
Share
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.
You can load the image into a canvas (using
drawImage()), then draw text on the canvas (usingfillText()).If you want to you can then take the image data from the canvas using
toDataUrl()and post that data to the server for image persistence.If you only need it for client side visibility you have a much simpler solution that doesn’t use html5. just overlay a text over the image using absolute positioning.