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

    Function imageDataToImgBlob

    • Converts an ImageData object into a Blob in PNG format.

      This operation is asynchronous and uses OffscreenCanvas to perform the encoding, making it suitable for usage in both the main thread and Web Workers.

      Parameters

      • imageData: ImageData

        The pixel data to be encoded.

      Returns Promise<Blob>

      A promise that resolves to a Blob with the MIME type image/png.

      Thrown if the OffscreenCanvas context cannot be initialized or the blob encoding fails.

      const blob = await imageDataToImgBlob(imageData);
      const url = URL.createObjectURL(blob);