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
1
vote
1 answer

Duplicated calls for resource with node-canvas and jsdom

I'm getting duplicated calls for a resource when it's added through a script as an image using jsdom and node-canvas. I believe there's some kind of interaction between jsdom and canvas that performs the call to that endpoint twice, I don't know if…
soni
  • 687
  • 1
  • 8
  • 23
1
vote
1 answer

registerFont() from node-canvas not parsing font on Firebase Cloud Functions

I am currently working on generating an image with node-canvas via Firebase Cloud Functions, then sending it as an email attachment with nodemailer. The requirement of the image is that I need to input some string onto a template with a specific…
1
vote
1 answer

Error: node-canvas was built without JPEG support

/Users/demo/canvas/node_modules/canvas/lib/image.js:91 SetSource.call(img, src); ^ Error: node-canvas was built without JPEG support at setSource (/Users/demo/canvas/node_modules/canvas/lib/image.js:91:13) at Image.set…
NikyPeng
  • 11
  • 2
1
vote
0 answers

Node.js Canvas image corruption

I'm very new to coding so I'm just piecing everything together from tutorials. Anyway, when I try to use Canvas.loadImage() on certain, large .png files, they visually corrupt. It doesn't happen with .jpgs, and it only happens with these specific…
soulus
  • 13
  • 4
1
vote
0 answers

Why is canvas breaking the build after upgrading from nextjs 10.0.5 to 10.0.6?

I upgraded from nextJs from 10.0.5 to 10.0.6 and the build is now failing with the following message: Error: Module did not self-register: '.../node_modules/canvas/build/Release/canvas.node. I am not importing canvas directly, but it's used by…
Eturcim
  • 798
  • 8
  • 26
1
vote
1 answer

Characters are not displayed in Canvas

When I try to display text on a picture using Canvas, some characters and emoji are displayed incorrectly on Windows and Ubuntu. 1 screen - on Windows, 2 screen - on Ubuntu. With any font, this is the situation. Canvas that on Windows, that on…
Mokcemka
  • 11
  • 4
1
vote
0 answers

JPG file loaded into the node canvas module loses quality after operations and export

I am using the node canvas implementation https://github.com/Automattic/node-canvas I use it to cut a jpg export of a newsletter design into slices and generate an image based HTML template that is email friendly. Essentially it's just slices from…
1
vote
1 answer

How can I tighten letter spacing on labels with ChartJS?

I'm trying to draw a chart using https://www.npmjs.com/package/chartjs-node-canvas but the labels have a strange letter spacing and they look too spaced out. Below is an image of a chart drawn with chart.js on the browser on the left and a chart…
Gligor
  • 2,862
  • 2
  • 33
  • 40
1
vote
3 answers

Getting "Permission Denied" when trying to install node.js canvas on Heroku

i am using canvas package for node.js it works fine on my pc but whenever i deploy it to heroku i always get an error here is what i get remote: -----> Installing dependencies remote: Prebuild detected (node_modules already exists) remote: …
1
vote
0 answers

Can't load svg with base64 image inside with node-canvas

I have an issue when load svg ( with base64 image inside ) file using function loadImage I get exception: GdkPixbuf-CRITICAL **: 13:03:49.842: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed Here is my code & test svg file: const…
Tho Bui Ngoc
  • 763
  • 1
  • 11
  • 36
1
vote
0 answers

Canvas doesn't install correctly for using webppl and webppl-viz

I am trying to run a simple script in WebPPL using the command line, which runs the following visualization: var fairCoin = function() { flip(0.5) ? 'h' : 't' }; viz(repeat(20, fairCoin)) Following the instructions on the GitHub repo, I have…
1
vote
0 answers

Nodejs Canvas module loads at command line but will not load in nssm service

When running a node app using the nssm service manager, the canvas module will not load, but when running the app from the command line it does. The service is running in win7/32 bits, node version is 10.16 and canvas version 2.5. Error: The…
1
vote
0 answers

Sailsjs+Canvas send image into view

Right now im using sailsjs + Canvas, Im trying to send a canvas created in backend, to the browser into a view. What i have done so far is creating a canvas in a controller and when you go to a route ex. /canvas it will show the image there. But how…
Tobias
  • 13
  • 4
1
vote
1 answer

Follow redirect on loadImage() function

I always get error "Error: Server responded with 301" when trying to use loadImage() function. The URL i provide in the function redirected from http to https, but instead of following the redirect, the function returned that error instead. async…
1
vote
1 answer

Static files in Jest tests

In my code that's being tested I'm creating an image like: const image = new Image(); image.addEventListener("load", () => {}); image.addEventListener("error", () => {}); image.src = "hello.png" When I run in the browser I have webpack copy that…
edbentley
  • 191
  • 10