Saves the Image to a byte array.

Namespace: ImageSense
Assembly: ImageSense (in ImageSense.dll) Version: 1.0.0.0 (1.0.0.0)

Syntax

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

Parameters

image
Type: System.Drawing..::..Image
The Image to output as bytes.
imageFormat
Type: System.Drawing.Imaging..::..ImageFormat
The file format of the image.

Return Value

A byte array representing the given 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 or .

Remarks

When calling this method, if the framework cannot find a formatter for imageFormat, an exception will be thrown.

See Also