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

    Function getSupportedPixelFormats

    • Probes the browser environment to determine which image MIME types are supported for pixel-level operations. This function performs a one-time check by attempting to convert a OffscreenCanvas to MIME types. The result is cached to prevent redundant hardware-accelerated operations on subsequent calls.

      Parameters

      • rasterMimes: string[] = defaultRasterMimes

        List of MIME types to check

      Returns Promise<string[]>

      A Promise resolving to an array of supported MIME types from the rasterMimes list.

      ['image/png',
      'image/jpeg',
      'image/webp',
      'image/avif',
      'image/gif',
      'image/bmp']

      If the OffscreenCanvas context cannot be initialized.

      const supported = await getSupportedPixelFormats();
      if (supported.includes('image/avif')) {
      console.log('High-efficiency formats available');
      }