Automattic / Automattic/node-canvas

`ctx.getImageData` reports `Floating point exception: 8` for canvas with 0 width/height

Open
#1,001 2 comments 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
10.7k
Forks
1.2k
Avg merge
4d 8h
Merged PRs (30d)
1

Description

## Issue

I'm using the latest version `2.0.0-alpha3`, and I keep running into `Floating point exception: 8`

I tried different images, but I still got the same result

## Steps to Reproduce
```js
fs.readFile(__dirname + '/static/t1.jpeg', (err, squid) => {
if (err) throw err;
const img = new Image;
const canvas = createCanvas(img.width, img.height);
const ctx = canvas.getContext('2d');
img.src = squid;
ctx.drawImage(img, 0, 0, img.width, img.height); //this is all good
const imageData = ctx.getImageData(0, 0, img.width, img.height); // return floating point exception: 8
});
```

## Your Environment
* Version of node-canvas (e.g. 1.4.0): 2.0.0-alpha3
* Environment (e.g. node 4.2.0 on Mac OS X 10.8): Mac OS X 10.12.6

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.