Skip to content

Commit 46f3f0b

Browse files
committed
Update dependencies
Fixes #46
1 parent c0552d0 commit 46f3f0b

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

index.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import process from 'node:process';
22
import fs from 'node:fs';
33
import fsPromises from 'node:fs/promises';
44
import chalk from 'chalk';
5-
import Jimp from 'jimp';
5+
import {Jimp, intToRGBA} from 'jimp';
66
import termImg from 'term-img';
77
import renderGif from 'render-gif';
88
import logUpdate from 'log-update';
@@ -71,18 +71,18 @@ function calculateWidthHeight(imageWidth, imageHeight, inputWidth, inputHeight,
7171
}
7272

7373
async function render(buffer, {width: inputWidth, height: inputHeight, preserveAspectRatio}) {
74-
const image = await Jimp.read(Buffer.from(buffer));
74+
const image = await Jimp.fromBuffer(buffer);
7575
const {bitmap} = image;
7676

7777
const {width, height} = calculateWidthHeight(bitmap.width, bitmap.height, inputWidth, inputHeight, preserveAspectRatio);
7878

79-
image.resize(width, height);
79+
image.resize({w: width, h: height});
8080

8181
let result = '';
82-
for (let y = 0; y < image.bitmap.height - 1; y += 2) {
83-
for (let x = 0; x < image.bitmap.width; x++) {
84-
const {r, g, b, a} = Jimp.intToRGBA(image.getPixelColor(x, y));
85-
const {r: r2, g: g2, b: b2} = Jimp.intToRGBA(image.getPixelColor(x, y + 1));
82+
for (let y = 0; y < bitmap.height - 1; y += 2) {
83+
for (let x = 0; x < bitmap.width; x++) {
84+
const {r, g, b, a} = intToRGBA(image.getPixelColor(x, y));
85+
const {r: r2, g: g2, b: b2} = intToRGBA(image.getPixelColor(x, y + 1));
8686
result += a === 0 ? chalk.reset(' ') : chalk.bgRgb(r, g, b).rgb(r2, g2, b2)(PIXEL);
8787
}
8888

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,17 +50,17 @@
5050
"sequence"
5151
],
5252
"dependencies": {
53-
"chalk": "^5.3.0",
53+
"chalk": "^5.4.1",
5454
"image-dimensions": "^2.3.0",
55-
"jimp": "^0.22.12",
55+
"jimp": "^1.6.0",
5656
"log-update": "^6.1.0",
5757
"render-gif": "^2.0.4",
5858
"term-img": "^7.0.0"
5959
},
6060
"devDependencies": {
61-
"@types/node": "^20.14.12",
62-
"ava": "^6.1.3",
63-
"tsd": "^0.31.1",
64-
"xo": "^0.59.2"
61+
"@types/node": "^22.10.5",
62+
"ava": "^6.2.0",
63+
"tsd": "^0.31.2",
64+
"xo": "^0.60.0"
6565
}
6666
}

0 commit comments

Comments
 (0)