Questions tagged [node-canvas]

Node canvas is a Cairo backed Canvas implementation for NodeJS.

Installation

$ npm install canvas

node-canvas extends the canvas API to provide interfacing with node, for example streaming PNG data, converting to a Buffer instance, etc. Among the interfacing API, in some cases the drawing API has been extended for SSJS image manipulation / creation usage, however keep in mind these additions may fail to render properly within browsers.

Github

Node Wiki

152 questions
0
votes
0 answers

Can't place images on canvas with JavaScript

I'm trying to make a Slot Game with canvas, but I can't place fruit images. Can you help me Thank you in advance for your help I tried making a Slot Game with canvas on discord The gambling bot I will build will exist to entertain people virtually.…
Kadirhan
  • 1
  • 3
0
votes
0 answers

FFMPEG rtmp stream slow and only works on chrome

I am trying to stream to twitch from a Node.js script for fun! so far i have got it working but its slow and seemingly limited to 10-12 fps. Here is my code, i am trying to stream a Node-Canvas to twitch so i can do stuff without the overhead of OBS…
DrMeepso
  • 27
  • 1
  • 6
0
votes
0 answers

Fonts not registering in Node.js with Canvas – what can I do?

I am working on a Node.js application that generates images with custom text using a specific font with canvas, specifically for a Discord bot. I am facing an issue while trying to use a custom font. The font works perfectly fine when it is…
Pierre-Louis
  • 17
  • 1
  • 6
0
votes
1 answer

Is it possible to make a pixelated bitmap font in node-canvas?

I've been recently working on a Node.js project that uses node-canvas module. Although I have a problem. I want to completely disable the font smoothing (like you can do in Paint.net, Photoshop, Adobe Animate, etc), so that the font is pixelated and…
gmdshxdow
  • 11
  • 6
0
votes
1 answer

node-canvas registerFont works on Windows but not on Linux

I use node-canvas, and use registerFont to use a specific font. This works fine locally on Windows, but when hosting my project on my Linux VPS it doesn't. It recognizes the path, because else it would give an error. When I use a different and bold…
0
votes
0 answers

ChartJSNodeCanvas with chartjs-plugin-datalabels issue labels after first chart

I have a nodejs server function creating a chart with ChartJSNodeCanvas. I use it to create several charts to put then inside pdf file. I had the request to put on top of bar chart bars the value (as on first picture example). For that, I'm using…
0
votes
0 answers

node-canvas can't load a font

So, I'm trying to use a custom font with canvas in this way: canva.registerFont('./src/fonts/alternate-gothic-cond-atf.otf', { family: 'Alternate Gothic Cond ATF' }); ctx.font = '60px Alternate Gothic Cond ATF' and get this: (process:4992):…
0
votes
0 answers

how to convert an rstp ffmpeg mp4 buffer into ImageData inside nodejs (nestjs)

I am reading an rtsp stream using ffmpeg in this way: const ffmpegArgs = [ '-rtsp_transport', 'tcp', '-i', this.rtspStreamPath, '-vcodec', 'copy', '-f', 'mp4', '-movflags', 'frag_keyframe+empty_moov', …
distante
  • 6,438
  • 6
  • 48
  • 90
0
votes
0 answers

@napi-rs/canvas rendered images look pixelated

I'm building a image using @napi-rs/canvas library. When i load local images, then look pixelated. Like the image below: Screenshot The small images look pixelated. I'm loading the local images using const verified = await Canvas.loadImage( …
0
votes
1 answer

node-canvas import ES Modules ( Mixing Import and Require )

I have a Dev environment ( macOS ) where import { createCanvas, loadImage, Image } from "canvas"; works fine, but in production ( AWS Linux ) the same import: import { createCanvas, loadImage, Image } from "./node_modules/canvas" ( if i don't use an…
user3094755
  • 1,561
  • 16
  • 20
0
votes
1 answer

Animated SVGs in canvg on node.js - how to render/request next frame?

I have a node.js process with a canvas that is being exported to a frame buffer as a bitmap (RGBA values in Uint8Array). Now I want to draw SVG to this canvas, and found canvg which works well for static SVG images so far. But I also need to show…
Esben von Buchwald
  • 2,772
  • 1
  • 29
  • 37
0
votes
0 answers

How to make `node-canvas` render pixel perfect fonts like Windows did in the 00s?

I'm writing a canvas-based app which is being shown on low resolution LED matrix RGB panels. It runs in Node JS and sends RGBA image bytes to a socket of a receiver. Because of the low resolution, I need pixel perfect text rendering, to make smaller…
0
votes
0 answers

Cache in node js

I am testing a nodejs script scanning image for nudity (on the base of nude.js). Script invokes module uses node canvas to analyse image. It returns true if there is nudity and false in other case. But the problem is script works right only at first…
0
votes
0 answers

How can I install node.js canvas on replit?

I am trying to install canvas on node.js replit and I get this error: how do I fix this? I already have node-gyp installed, and when I tried to install on yarn I got a similar error. My node version is 18.2.0
wmrisgood
  • 31
  • 2
0
votes
1 answer

Installation of npm package "node-canvas" fails every time. How do I interpret the error message in my console?

I am trying to install the npm package node-canvas. It does not work. This is (an extract of) the error message that I get in my console. Could someone please help me to interpret these errors? I already tried re-installing properly node-pre-gyp and…
bassman21
  • 320
  • 2
  • 11