Skip to content

Commit 3e021c9

Browse files
authored
Upgrade jimp to 1.6.0 (#96)
* Upgrade jimp to 1.6.0 * Bump serve-handler minor version Removes use of deprecated node package
1 parent 3b4cc09 commit 3e021c9

File tree

3 files changed

+1075
-693
lines changed

3 files changed

+1075
-693
lines changed

index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const path = require('path');
88
const ProgressBar = require('cli-progress');
99
const fs = require('fs');
1010
const buffer = require('buffer').Buffer;
11-
const Jimp = require('jimp');
11+
const Jimp = require('jimp').Jimp;
1212
const readline = require('readline');
1313
const assert = require('assert');
1414

@@ -200,7 +200,7 @@ function generateBMFont (fontPath, opt, callback, customLog) {
200200
let svg = "";
201201
let texname = "";
202202
let fillColor = fieldType === "msdf" ? 0x000000ff : 0x00000000;
203-
let img = new Jimp(bin.width, bin.height, fillColor);
203+
let img = new Jimp({width: bin.width, height: bin.height, color: fillColor});
204204
if (index > pages.length - 1) {
205205
if (packer.bins.length > 1) texname = `${filename}.${index}`;
206206
else texname = filename;
@@ -235,7 +235,7 @@ function generateBMFont (fontPath, opt, callback, customLog) {
235235
charData.page = index;
236236
chars.push(rect.data.fontData);
237237
});
238-
const buffer = await img.getBufferAsync(Jimp.MIME_PNG);
238+
const buffer = await img.getBuffer("image/png");
239239
let tex = {
240240
filename: path.join(fontDir, texname),
241241
texture: buffer

0 commit comments

Comments
 (0)