#How to create a square of color with canvas
15 messages · Page 1 of 1 (latest)
show error stack
seems like not a error with canvas tbh
error stack, not code
could you log attachment?
thats the issue
canvas.encode, not .toBuffer
which canvas package u using?
hmm...
Shouldn't you use a mime type for toBuffer?
you can also not pass in any parameters, it should still create a PNG buffer
e.g.
canvas.toBuffer() <- still should make it a PNG
or
canvas.toBuffer('image/png');
This is the signature for the function.
canvas.toBuffer((err: Error|null, result: Buffer) => void, mimeType?: string, config?: any) => void
canvas.toBuffer(mimeType?: string, config?: any) => Buffer
Should be pretty simple from what you have now.
just get the canvas.height and width, select 0 as 1 param in start coords, and place the canvas width and height in end coords