Pixel Data JS - v0.28.0
    Preparing search index...

    Function imgBlobToImageData

    • Decodes a Blob (typically PNG) back into an ImageData object.

      This function uses hardware-accelerated decoding via createImageBitmap and processes the data using an OffscreenCanvas to ensure compatibility with Web Workers.

      Parameters

      • blob: Blob

        The binary image data to decode.

      Returns Promise<ImageData>

      A promise resolving to the decoded ImageData.

      Thrown if the blob is corrupted or the browser cannot decode the format.

      const blob = await getBlobFromStorage();

      const imageData = await pngBlobToImageData(blob);