public static byte[] AsRgba8888(this IImageRead image) { switch (image.PixelFormat) { case PixelFormat.Indexed4: return(image.From4bpp(Rgba)); case PixelFormat.Indexed8: return(image.From8bpp(Rgba)); default: throw new ArgumentException($"The pixel format {image.PixelFormat} is not supported."); } }