Automattic / Automattic/node-canvas

Error: Unsupported image type

Open
#1,709 13 comments 0 reactions 0 assignees View on GitHub
Needs more info
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

## Issue
Error: Unsupported image type
at setSource (C:\Users\Usr\Desktop\Xenova-rewrite-master\node_modules\canvas\lib\image.js:91:13)
at C:\Users\Usr\Desktop\Xenova-rewrite-master\node_modules\canvas\lib\image.js:59:11
at C:\Users\Usr\Desktop\Xenova-rewrite-master\node_modules\simple-get\index.js:89:7
at IncomingMessage. (C:\Users\Usr\Desktop\Xenova-rewrite-master\node_modules\simple-concat\index.js:8:13)
at Object.onceWrapper (events.js:421:28)
at IncomingMessage.emit (events.js:327:22)
at endReadableNT (_stream_readable.js:1327:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)

## Steps to Reproduce
```js
const canvas = Canvas.createCanvas(900, 500);

const ctx = canvas.getContext('2d');

Canvas.registerFont('Font/visitor1.ttf', { family: "visitor" });

const background = await Canvas.loadImage("Images/joinleave1.jpg");

ctx.drawImage(background, 0, 0, canvas.width, canvas.height);

ctx.strokeStyle = '#74037b';

ctx.strokeRect(0, 0, canvas.width, canvas.height);

ctx.font = '25px visitor';
ctx.fillStyle = '#ffffff';
ctx.fillText(`Level ${r[0].level}`, canvas.width / 3, canvas.height / 3.7);

ctx.beginPath();

ctx.arc(125, 125, 100, 0, Math.PI * 2, true);

ctx.closePath();

ctx.clip();

const avatar = await Canvas.loadImage(message.author.displayAvatarURL());

ctx.drawImage(avatar, 25, 0, 200, canvas.height);

const attachment = new Attachment(canvas.toBuffer(), "level.jpg")

message.channel.send(attachment);
```

## Your Environment
Canvas 2.6.0
Windows 10 (x64)
Node 14.14.0

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.