text to image using node js|text2png using node js

Deal Score0
Deal Score0
Spread the love

Node js Provide lots of free library in node js packagesĀ  .If you want to use any custom fonts You can also use.

first of all install these packages,

npm install text2png express

packages.json

{
  "name": "converter",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1",
    "image-downloader": "^4.0.2",
    "text2png": "^2.3.0"
  }
}

let create now index.js File

 

const express=require('express')
const download = require('image-downloader')

const app= express()
var fs = require('fs');
var text2png = require('text2png');
  app.get("/",function(req,res){
      fs.writeFileSync('out1.png', text2png('Hello!', {color: 'blue'}));
  
  })

  app.listen(8000)

 

We will be happy to hear your thoughts

Leave a reply

Logo
Enable registration in settings - general