Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- async function jimpa(date, pos, hel, dec, difftw_pos, difftw_he, difftw_dec, tot, difftw_tot){
- var fileName = 'covid.png';
- var loadedImage;
- await Jimp.read(fileName)
- .then(function (image) {
- loadedImage = image;
- return Jimp.loadFont('fonts/data/data.fnt');
- })
- .then(function (font) {
- loadedImage.print(font, 392, 246, date)
- .write(fileName);
- console.log("Writing data...");
- })
- .catch(function (err) {
- console.error(err);
- });
- await Jimp.read(fileName)
- .then(function (image) {
- loadedImage = image;
- return Jimp.loadFont('fonts/stats/stats.fnt');
- })
- .then(function (font) {
- loadedImage.print(font, 388, 514, numtw(pos))
- loadedImage.print(font, 388, 900, numtw(hel))
- loadedImage.print(font, 388, 1287, numtw(dec))
- .write(fileName);
- console.log("Writing stats...");
- })
- .catch(function (err) {
- console.error(err);
- });
- await Jimp.read(fileName)
- .then(function (image) {
- loadedImage = image;
- return Jimp.loadFont('fonts/stats-min/stats-min.fnt');
- })
- .then(function (font) {
- loadedImage.print(font, 917, 703, numtw(difftw_pos))
- loadedImage.print(font, 884, 1088, numtw(difftw_he))
- loadedImage.print(font, 1035, 1473, numtw(difftw_dec))
- .write(fileName);
- console.log("Writing diff stats...");
- })
- .catch(function (err) {
- console.error(err);
- });
- await Jimp.read(fileName)
- .then(function (image) {
- loadedImage = image;
- return Jimp.loadFont('fonts/tot/tot.fnt');
- })
- .then(function (font) {
- loadedImage.print(font, 388, 1694, numtw(tot))
- .write(fileName);
- console.log("Writing tot cases...");
- })
- .catch(function (err) {
- console.error(err);
- });
- await Jimp.read(fileName)
- .then(function (image) {
- loadedImage = image;
- return Jimp.loadFont('fonts/tot-min/tot-min.fnt');
- })
- .then(function (font) {
- loadedImage.print(font, 1340, 1911, numtw(difftw_tot))
- .write(fileName);
- console.log("Writing tot cases diff...");
- })
- .catch(function (err) {
- console.error(err);
- });
- await exec("node convert.js");
- }
Advertisement
Add Comment
Please, Sign In to add comment