Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
wordwrapimagewriter
Advanced tools
ES6 JS class to write text onto image with word wrapping
npm install wordwrapimagewriter --save
Write lines onto an image wrapping and automatically determining
spacing and padding as specified
// Instantiate the writer
var writer = new wordwrapimagewriter({
imgFilename: './imageToWriteOnto.png',
availableLines: 3, // your maximum line number you allow
topPadPx: 50, // spacing from top of image to move down before writing
lineBottomPadPx: 5, // spacing at bottom of each line
fontFile: './HelveticaBold.ttf',
});
// Call open to asynchronously load image before writing
writer.openImg(() => {
// The color declarations are from the node-gd package in rgba format
var usernameColor = writer.img.colorAllocateAlpha(255, 20, 20, 1);
var textColor = writer.img.colorAllocateAlpha(255, 255, 255, 1);
var usernameText = "jenk37: ";
var messageText = "I think that the wordwrapimagewriter is pretty good";
// Write text onto the image. If the text takes more more lines
// than availableLines, it will return the text that did not fit.
var textThatWontFit = writer.writeText(usernameText, usernameColor);
if (textThatWontFit) {
console.log("[!] Text couldn't fit:", comment.username);
}
// Change font or size. Changing size will automatically update lineLength
writer.setFontSize(30);
writer.setFont('./Helvetica.ttf');
textThatWontFit = writer.writeText(messageText, textColor);
if (textThatWontFit) {
console.log("[!] Text couldn't fit:", textThatWontFit);
}
// Save the image file
writer.save("./newImageFilename.png", () => {
return callback();
});
});
FAQs
ES6 JS class to write text onto image with word wrapping
The npm package wordwrapimagewriter receives a total of 3 weekly downloads. As such, wordwrapimagewriter popularity was classified as not popular.
We found that wordwrapimagewriter 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.