Files
Examples/JavaScript/pureimageTest/index.js
2018-06-17 19:47:18 +01:00

47 lines
2.9 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
const fs = require('fs');
const Jimp = require('jimp');
let str = 'Hello, world! ┌─-─┬ │ ♖ │ ♘ │ \n HEllo'
//let str ='┌─-─┬─-─┬─-─┬─-─┬─-─┬─-─┬─-─┬─-─┬─-─┐ \n' +
// '│ │ \n' +
// '├─-─╆━-━┿━-━┿━-━┿━-━┿━-━┿━-━┿━-━┿━-━┥ \n' +
// '| ┃ ♖ │ ♘ │ ♗ │ ♕ │ ♔ │ ♗ │ ♘ │ ♖ | \n' +
// '├─-─╂─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┤ \n' +
// '| ┃ ♙ │ ♙ │ ♙ │ ♙ │ ♙ │ ♙ │ ♙ │ ♙ | \n' +
// '├─-─╂─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┤ \n' +
// '| | \n' +
// '├─-─╂─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┤ \n' +
// '| | \n' +
// '├─-─╂─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┤ \n' +
// '| | \n' +
// '├─-─╂─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┤ \n' +
// '| | \n' +
// '├─-─╂─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┤ \n' +
// '| ┃ ♟ │ ♟ │ ♟ │ ♟ │ ♟ │ ♟ │ ♟ │ ♟ | \n' +
// '├─-─╂─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┼─-─┤ \n' +
// '| ┃ ♜ │ ♞ │ ♝ │ ♚ │ ♛ │ ♝ │ ♞ │ ♜ | \n' +
// '└─-─┸─-─┴─-─┴─-─┴─-─┴─-─┴─-─┴─-─┴─-─┘ \n';
Jimp.read("resources/start.png").then(function (image) {
image.resize(1200, 1200);
Jimp.loadFont(Jimp.FONT_SANS_32_BLACK).then(function (font) {
image.print(font, 10, 10, str);
image.write('resources/chess/img.png');
});
}).catch(function (err) {
console.error(err);
});
//var flag = new Jimp(200, 200, (err2, base) => {
// image.contain(604, 303, Jimp.RESIZE_BICUBIC, (err3, src) => {
// base.composite(src, 0, 88)
// .composite(background, 0, 0)
// .getBuffer(Jimp.MIME_PNG, (err4, buffer) => {
// //message.channel.send(new Discord.Attachment(buffer));
// });
// });
//});