Converts the specified image to a byte array using format specified by the image.

Namespace: System.Extensions.Drawing
Assembly: System.Extensions (in System.Extensions.dll) Version: 0.0.0.5 (0.0.0.5)

Syntax

C#
public static byte[] ToByteArray(
	this Image image
)
Visual Basic
<ExtensionAttribute> 
Public Shared Function ToByteArray ( 
	image As Image
) As Byte()
Visual C++
public:
[ExtensionAttribute]
static array<unsigned char>^ ToByteArray(
	Image^ image
)
F#
static member ToByteArray : 
        image : Image -> byte[] 

Parameters

image
Type: System.Drawing..::..Image
The Image to convert.

Return Value

Type: array<Byte>[]()[][]
The byte array representation of the image.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Image. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).

See Also