Skip to content

seleb/just-give-me-the-pixels

Repository files navigation

just-give-me-the-pixels

get pixel data without colour profile

npm i just-give-me-the-pixels

order of attempts at retrieving pixel data will be:

  • loading into an ImageBitmap and reading from a WebGL framebuffer
  • fetching as a buffer and parsing via image-decode
  • loading into an img, drawing into a canvas, and reading via ImageData

example:

import { getPixels } from 'just-give-me-the-pixels';
const { width, height, data } = await getPixels('image src.png');

note: the primary motivation for this module was to address issues on firefox which may have been fixed in v89