
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
📺 Live Demo
Convert text to image. Work with unicode and web font like FontAwesome, you can use emoji too. 🚀
NPM:
npm install text-image
CDN:
<script src="https://cdn.jsdelivr.net/npm/text-image/dist/text-image.js"></script>
Code example:
// create new TextImage object
var textImage1 = TextImage();
// create new TextImage object with customize style
var style = {
font: 'serif',
align: 'center',
color: 'red',
size: 18,
background: 'white',
stroke: 1,
strokeColor: 'rgba(0, 0, 0, 0)',
lineHeight: '1.6em',
bold: true,
italic: true
};
var textImage2 = TextImage(style);
// convert text message to image element
var img = textImage.toImage('MESSAGE');
// convert text message to base64 dataURL
var data = textImage.toDataURL(message);
// change style
textImage.setStyle(style);
The default style object
{
font: 'Sans-serif',
align: 'left',
color: '#000000',
size: 16,
background: 'rgba(0, 0, 0, 1)',
stroke: 0,
strokeColor: '#FFFFFF',
lineHeight: '1.2em'
}
The font property like css font-family and you can use web fonts like FontAwesome.
The align property specifies the horizontal alignment of text, use 'left', 'center' or 'right'.
The color, background and strokeColor property like css color.
/* <named-color> values */
color: 'red'
color: 'orange'
color: 'tan'
color: 'rebeccapurple'
/* <hex-color> values */
color: '#090'
color: '#009900'
color: '#090a'
color: '#009900aa'
/* <rgb()> values */
color: 'rgb(34, 12, 64, 0.6)'
color: 'rgba(34, 12, 64, 0.6)'
color: 'rgb(34 12 64 / 0.6)'
color: 'rgba(34 12 64 / 0.3)'
/* <hsl()> values */
color: 'hsl(30, 100%, 50%, 0.6)'
color: 'hsla(30, 100%, 50%, 0.6)'
color: 'hsl(30 100% 50% / 0.6)'
color: 'hsla(30 100% 50% / 0.6)'
The size and stroke property is the text size and outline width, only use numbers.
The lineHeight property like css line-height.
This project is licensed under the MIT License - see the LICENSE file for details
FAQs
Convert text to image with javascript
We found that text-image demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.