RegisterNativeBinary

Registers any embedded native (unmanaged) binaries required by ImageProcessor.

RegisterNativeBinary(string name, byte[] resourceBytes)
    

Parameters

name
The name of the native binary.
resourceBytes
The resource bytes containing the native binary.

Examples

In this example a reference to an embedded C++ binary that allows for manipulation of images using the Google WebP image format is registered.

string folder = ImageProcessorBootstrapper.Instance.NativeBinaryFactory.Is64BitEnvironment ? "x64" : "x86";
string name = string.Format("ImageProcessor.Plugins.WebP.Resources.Unmanaged.{0}.libwebp.dll", folder);
Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(name);

using (MemoryStream memoryStream = new MemoryStream())
{
    if (stream != null)
    {
        stream.CopyTo(memoryStream);
        ImageProcessorBootstrapper.Instance.NativeBinaryFactory.RegisterNativeBinary("libwebp.dll", memoryStream.ToArray());
    }
}