Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

any plan for implementing images #15

Open
chollan opened this issue Mar 16, 2021 · 1 comment
Open

any plan for implementing images #15

chollan opened this issue Mar 16, 2021 · 1 comment

Comments

@chollan
Copy link

chollan commented Mar 16, 2021

This is more of a feature request, or for someone to point me in the right direction: is there any plan to support images using the setImageBuffer method or any similar? i see images are supported within easybotics/node-red-contrib-easybotics-led-matrix, but i see no documentation about images for nodejs.

@nguyenthaohut
Copy link

`var LedMatrix = require("easybotics-rpi-rgb-led-matrix");
var fs = require('fs');
var path = require('path');
const Jimp = require("jimp");
const bufferImage = require("buffer-image");
//init a 16 rows by 16 cols led matrix
//default hardware mapping is 'regular', could be 'adafruit-hat-pwm' ect
var matrix = new LedMatrix(64, 64,2,1,'regular');
let imgpath = path.join(__dirname, 'vms.bmp');
console.log(imgpath);
//let imgf = fs.readFileSync(imgpath);
//let fimgb = Buffer.from(imgf,'binary');
Jimp.read(imgpath, function (err, image) {
if (err) {
console.log(err);
} else {
//console.log(image);
//const fimgb = image.getBuffer();
//const fimgb = Buffer.from(image,'binary');
image.getBuffer(Jimp.MIME_BMP, (err, buffer) => {
console.log(buffer);
//console.log(fimgb);
while(1)
{
//matrix.drawCircle(15,35,10,0,255,255);
matrix.brightness(95);
//matrix.fill(0, 255, 0);
matrix.setImageBuffer(buffer,64,64);
matrix.update();
}
});

}

})
I try to set buffer but it return error: node: ../src/ledmatrix.cc:530: static void LedMatrix::SetImageBuffer(const Nan::FunctionCallbackInfo<v8::Value>&): Assertion(int)bufl == widthheight3' failed.
Aborted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants