Options
All
  • Public
  • Public/Protected
  • All
Menu

Index

Functions

Functions

getPixels

  • getPixels(src: string): Promise<{ data: Uint8Array | Uint8ClampedArray; height: number; width: number }>
  • get pixel data without colour profile

    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');
    

    Parameters

    • src: string

      image source

    Returns Promise<{ data: Uint8Array | Uint8ClampedArray; height: number; width: number }>

    image width, height, and data

Generated using TypeDoc