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

use Canvas#toBuffer() instead #10

Open
jimmywarting opened this issue May 24, 2021 · 1 comment
Open

use Canvas#toBuffer() instead #10

jimmywarting opened this issue May 24, 2021 · 1 comment

Comments

@jimmywarting
Copy link

Drop this lib

const Frame = require('canvas-to-buffer');

it will work much faster

@pi0neerpat
Copy link

pi0neerpat commented Dec 21, 2021

Just did some testing on this, and didn't see any performance improvements. It might have been my implementation, but I actually saw a 100ms increase. You still need canvas, since canvas-to-buffer doesn't include tooling for createCanvas or loadImage. The latter could be abstracted away using svgs, but the former will always be needed. eg:

const { createCanvas, loadImage } = require("canvas");
const Frame = require("canvas-to-buffer");

const canvas = createCanvas(this.size, this.size);
// ... all the existing code

// Output
const frame = new Frame(canvas);
return frame.toBuffer();

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