image-js / image-js-typescript

Temporary repository to work on the migration of image-js to TypeScript
https://image-js.github.io/image-js-typescript/
MIT License
5 stars 5 forks source link

getImageData #430

Open lpatiny opened 6 months ago

lpatiny commented 6 months ago

Need to convert the image to RGBA and then get the raw data

image

targos commented 6 months ago

This can only work by default in the browser (ImageData doesn't exist in Node.js). For the test case, a fake class could be added in a before hook:

globalThis.ImageData = class ImageData {
  // Minimal implementation for the test.
}

And deleted in an after hook:

delete globalThis.ImageData;

API: https://developer.mozilla.org/en-US/docs/Web/API/ImageData/ImageData