DEV Community

loading...
Cover image for Exclusive: convert text into image in JavaScript!! (Easy peasy)

Exclusive: convert text into image in JavaScript!! (Easy peasy)

Raghav9official
var Coder => (){ ”always” = true; }
Updated on ・1 min read

Hello guys have you ever wondered how to change text into an image in JavaScript?

Well in this tutorial I am going to tell you how to do that and this is damn easy:

I will use hash.JS as a mentioned it in my previous articles...

Imported by :

<script src="https://siliconduct.github.io/hash.js/hashtag_1.0.1.js"></script>
Enter fullscreen mode Exit fullscreen mode

You can do that by a simple command shown below:

hash("#canvas").textToImg("textToImg!");
Enter fullscreen mode Exit fullscreen mode

And he texted is automatically drawn in the Canvas element as a picture !!!

Just like this:
Alt Text

Discussion (0)