officefileapi-devexpress-dot-office-dot-utils-dot-officeimage-dot-getimagebytes-x28-devexpress-dot-office-dot-utils-dot-officeimageformat-x29.md
Returns a byte array of image data encoded in the specified format.
Namespace : DevExpress.Office.Utils
Assembly : DevExpress.Office.v25.2.Core.dll
NuGet Package : DevExpress.Office.Core
public abstract byte[] GetImageBytes(
OfficeImageFormat imageFormat
)
Public MustOverride Function GetImageBytes(
imageFormat As OfficeImageFormat
) As Byte()
| Name | Type | Description |
|---|---|---|
| imageFormat | OfficeImageFormat |
An OfficeImageFormat enumeration member specifying the format of the resulting image data.
|
| Type | Description |
|---|---|
| Byte[] |
A Byte array that contains the image data.
|
The following code snippets (auto-collected from DevExpress Examples) contain references to the GetImageBytes(OfficeImageFormat) method.
Note
The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.
winforms-richedit-build-a-mail-application/CS/RichEditSendMail/Form1.cs#L112
OfficeImageFormat imageFormat = GetActualImageFormat(image.RawFormat);
Stream stream = new MemoryStream(image.GetImageBytes(imageFormat));
string mediaContentType = OfficeImage.GetContentType(imageFormat);
{
employeePictures.Add(pic.Name, DXImage.FromStream(new MemoryStream(pic.Image.GetImageBytes(OfficeImageFormat.Bmp))));
}
office-file-api-ai-implementation/CS/BusinessObjects/OpenAIClientImageHelper.cs#L20
internal async Task<string> DescribeImageAsync(OfficeImage image) {
return await GetImageDescription(image.GetImageBytes(OfficeImageFormat.Png));
}
winforms-richedit-build-a-mail-application/VB/RichEditSendMail/Form1.vb#L104
Dim imageFormat As OfficeImageFormat = GetActualImageFormat(image.RawFormat)
Dim stream As Stream = New MemoryStream(image.GetImageBytes(imageFormat))
Dim mediaContentType As String = OfficeImage.GetContentType(imageFormat)
For Each pic As Picture In sheet.Pictures
employeePictures.Add(pic.Name, DXImage.FromStream(New MemoryStream(pic.Image.GetImageBytes(OfficeImageFormat.Bmp))))
Next pic
See Also