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
34
votes
9 answers

Nodejs Cannot find module '../build/Release/canvas'

I installed cairo, and node-canvas. I tried everything, but still can't find module. sudo apt-get install libcairo2-dev sudo npm install canvas sudo npm install canvas -g If I run require('canvas'), I get this error: Error: Cannot find module…
friction
  • 787
  • 2
  • 10
  • 15
21
votes
4 answers

Best way to record a HTML Canvas/WebGL animation server-side into a video?

I have a set of animations which I can make in Canvas (fabric.js) or WebGL (three.js). I need to record them automatically, server-side, through a script and output a video file. The animations include: Pictures Videos (with audio) Other…
Abhinav
  • 722
  • 2
  • 11
  • 27
15
votes
4 answers

How can I ovecome this error in npm install?

I'm a beginner programmer, and I'm making a discord bot using node and discord.js. I need a library named canvas, but it doesn't install! I programmed and tested this app on my windows pc, then sent it over to my raspberry server. It didn't work, so…
Samu Nemeth
  • 393
  • 1
  • 3
  • 16
12
votes
5 answers

node canvas on alpine within docker

I'm trying to install node canvas (https://github.com/Automattic/node-canvas) on Alpine within docker. These are (parts of) my Dockerfile: # Use node/alpine image for final build FROM keymetrics/pm2:latest-alpine as app # install dependencies for…
Roy Milder
  • 886
  • 2
  • 11
  • 19
9
votes
2 answers

Add image as frame to a gif

So I want to create a gif and add an image as a frame. I am using gifencoder. I've seen the examples and its pretty easy to add colors, txt etc, but I couldnt figure out how to do the same with an image. Do I need something like the png file…
nonerth
  • 549
  • 2
  • 7
  • 19
8
votes
1 answer

Emoji to PNG or JPG in Node.js - how to?

For the project I'm working on I need to generate an image file from emoji (ideally Apple emoji). I thought it should be a fairly simple thing, but with each tool I use, I eventually run into a wall. I've also considered working with an emoji set,…
user2634633
  • 509
  • 8
  • 21
8
votes
2 answers

How to enable jpeg support in node-canvas on x64 windows with MSVC10 compiler?

I need to render jpeg images on nodejs serverside. I install canvas npm module with following build instructions: https://github.com/Automattic/node-canvas/wiki/Installation---Windows I have C:\libjpeg-turbo\ as it is mentioned in the manual. If I…
Stepan Yakovenko
  • 8,670
  • 28
  • 113
  • 206
7
votes
1 answer

How to convert a remote webp image to a png image to load it into node-canvas

Usually I import png images into Canvas by using const image = Canvas.LoadImage('url.png') const canvas = Canvas.createCanvas(256,256) const ctx = canvas.getContext('2d') ctx.drawImage(image,256,256) but when i try to import a webp image, I get an…
Jytesh
  • 815
  • 4
  • 15
7
votes
2 answers

node-canvas: Using custom font

I would like to know how to use custom font with node-canvas. Here is my attempt but it does not work so far: var Canvas = require('canvas') , Image = Canvas.Image , Font = Canvas.Font , path = require('path'); var gubblebum = new…
mc9
  • 6,121
  • 13
  • 49
  • 87
6
votes
1 answer

Node canvas use fallback font for unknown characters

I'm using Node-Canvas to print text on an image and trying to figure out how to ensure strange characters are displayed correctly, even if the main font can't display them. From what I found online you have to use registerFont with a font that can…
Aci
  • 546
  • 5
  • 22
6
votes
1 answer

How can i stream through ffmpeg a canvas generated in Node.js to youtube/any other rtmp server?

i wanted to generate some images in Node.JS, compile them to a video and stream them to youtube. To generate the images i'm using the node-canvas module. This sounds simple enough, but i wanted to generate the images continuously, and stream the…
DDC
  • 61
  • 4
6
votes
1 answer

Node.js canvas implementation with Uint8ClampedArray

To any canvas pros out there–I need help. I'm using node-canvas and I'm trying to get imageData using it's getImageData method. Unfortunately it returns: interface ImageData { readonly attribute unsigned long width; readonly attribute…
Arek
  • 219
  • 2
  • 9
6
votes
1 answer

How to render image as pdf (canvas and pdfkit)

I have a function on nodejs that generates an image from many images and then generate a pdf file from that. Im trying with just one image but i need to add more, but this doesnt seems to work function HelperHandler() { this.pdf = function(req,…
jtomasrl
  • 1,430
  • 3
  • 13
  • 22
5
votes
1 answer

FabricJS convert json to png

I have created the following image as fabricjs-json: The json looks like the following: { "version": "5.2.1", "objects": [ { "type": "circle", "version": "5.2.1", "originX": "center", …
Carol.Kar
  • 4,581
  • 36
  • 131
  • 264
5
votes
1 answer

Getting a users about me if has one using discordjs

So im trying to get the about me section on a users profile and then putting it on a node canvas didn't find a document on the discordjs so just checking if its even possible my code for the profile canvas: const Discord =…
It'sMateo20
  • 105
  • 2
  • 8
1
2 3
10 11