Click or drag to resize
Accord.NET (logo)

UnmanagedImageToManagedImage Method (Boolean)

Create managed image from the unmanaged.

Namespace:  Accord.Imaging
Assembly:  Accord.Imaging (in Accord.Imaging.dll) Version: 3.8.0
public Bitmap ToManagedImage(
	bool makeCopy
Request Example View Source


Type: SystemBoolean
Make a copy of the unmanaged image or not.

Return Value

Type: Bitmap
Returns managed copy of the unmanaged image.
InvalidImagePropertiesExceptionThe unmanaged image has some invalid properties, which results in failure of converting it to managed image. This may happen if user used the UnmanagedImage(IntPtr, Int32, Int32, Int32, PixelFormat) constructor specifying some invalid parameters.

If the makeCopy is set to , then the method creates a managed copy of the unmanaged image, so the managed image stays valid even when the unmanaged image gets disposed. However, setting this parameter to creates a managed image which is just a wrapper around the unmanaged image. So if unmanaged image is disposed, the managed image becomes no longer valid and accessing it will generate an exception.

See Also