Guest User

jimp issue zlib error

a guest
Aug 22nd, 2020
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. async function jimpa(date, pos, hel, dec, difftw_pos, difftw_he, difftw_dec, tot, difftw_tot){
  2.  
  3. var fileName = 'covid.png';
  4.  
  5. var loadedImage;
  6.  
  7. await Jimp.read(fileName)
  8.     .then(function (image) {
  9.         loadedImage = image;
  10.         return Jimp.loadFont('fonts/data/data.fnt');
  11.     })
  12.     .then(function (font) {
  13.         loadedImage.print(font, 392, 246, date)
  14.                    .write(fileName);
  15.  
  16. console.log("Writing data...");
  17.  
  18.     })
  19.     .catch(function (err) {
  20.         console.error(err);
  21.     });
  22.  
  23. await Jimp.read(fileName)
  24.     .then(function (image) {
  25.         loadedImage = image;
  26.         return Jimp.loadFont('fonts/stats/stats.fnt');
  27.     })
  28.     .then(function (font) {
  29.         loadedImage.print(font, 388, 514, numtw(pos))
  30.         loadedImage.print(font, 388, 900, numtw(hel))
  31.         loadedImage.print(font, 388, 1287, numtw(dec))
  32.                    .write(fileName);
  33.  
  34. console.log("Writing stats...");
  35.  
  36.     })
  37.     .catch(function (err) {
  38.         console.error(err);
  39.     });
  40.  
  41. await Jimp.read(fileName)
  42.     .then(function (image) {
  43.         loadedImage = image;
  44.         return Jimp.loadFont('fonts/stats-min/stats-min.fnt');
  45.     })
  46.     .then(function (font) {
  47.         loadedImage.print(font, 917, 703, numtw(difftw_pos))
  48.         loadedImage.print(font, 884, 1088, numtw(difftw_he))
  49.         loadedImage.print(font, 1035, 1473, numtw(difftw_dec))
  50.                    .write(fileName);
  51.  
  52. console.log("Writing diff stats...");
  53.  
  54.     })
  55.     .catch(function (err) {
  56.         console.error(err);
  57.     });
  58.  
  59. await Jimp.read(fileName)
  60.     .then(function (image) {
  61.         loadedImage = image;
  62.         return Jimp.loadFont('fonts/tot/tot.fnt');
  63.     })
  64.     .then(function (font) {
  65.         loadedImage.print(font, 388, 1694, numtw(tot))
  66.                    .write(fileName);
  67.  
  68. console.log("Writing tot cases...");
  69.  
  70.     })
  71.     .catch(function (err) {
  72.         console.error(err);
  73.     });
  74.  
  75. await Jimp.read(fileName)
  76.     .then(function (image) {
  77.         loadedImage = image;
  78.         return Jimp.loadFont('fonts/tot-min/tot-min.fnt');
  79.     })
  80.     .then(function (font) {
  81.         loadedImage.print(font, 1340, 1911, numtw(difftw_tot))
  82.                    .write(fileName);
  83.  
  84. console.log("Writing tot cases diff...");
  85.  
  86.     })
  87.     .catch(function (err) {
  88.         console.error(err);
  89.     });
  90.  
  91. await exec("node convert.js");
  92.  
  93. }
Advertisement
Add Comment
Please, Sign In to add comment