Commit 5ee7d810 authored by Stefan Scherer's avatar Stefan Scherer

Add text

parent b47b37c3
...@@ -22,10 +22,13 @@ Jimp.read(path).then(image => { ...@@ -22,10 +22,13 @@ Jimp.read(path).then(image => {
Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(black => { Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(black => {
Jimp.loadFont(Jimp.FONT_SANS_32_WHITE).then(white => { Jimp.loadFont(Jimp.FONT_SANS_32_WHITE).then(white => {
console.log('Got font'); console.log('Got font');
const text = `${os.hostname()}`;
image image
.scaleToFit(800, 600) .scaleToFit(800, 600)
.print(black, 10, 10, os.hostname()) .print(black, 10, 10, text)
.print(white, 8, 8, os.hostname()) .print(white, 8, 8, text)
.quality(98) // set JPEG quality .quality(98) // set JPEG quality
.getBuffer(Jimp.MIME_JPEG, (err, data) => { .getBuffer(Jimp.MIME_JPEG, (err, data) => {
console.log(`Listening on port ${port} serving file ${file}.`); console.log(`Listening on port ${port} serving file ${file}.`);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment