public byte[] ToDibArray(
RasterConvertToDibType type
)
public:
array<byte>^ ToDibArray(
RasterConvertToDibType type
)
def ToDibArray(self,type):
type
Type of DIB to create.
An array of Byte that contains the handle to the Windows DIB.
When this method is completed, there are two copies of the image in memory: the DIB and the original RasterImage. Freeing one will not affect the other.
This methods allocates a DIB bitmap and copies the RasterImage to the DIB.
A DIB consists of one of the following:
followed by a color table and then the bitmap data. The resulting DIB type is determined by the value of the type parameter.
The orientation of the image and color order will depend on how the image was loaded into the RasterImage.
For more information on DDBs and DIBs, refer to Introduction: DIBs, DDBs, and the Clipboard.
This function does not support signed images.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;
using Leadtools.ImageProcessing.Color;
using Leadtools.Dicom;
using Leadtools.Drawing;
using Leadtools.Controls;
using Leadtools.Svg;
public void ToDibArrayExample()
{
RasterCodecs codecs = new RasterCodecs();
byte[] dibData;
using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")))
{
dibData = image.ToDibArray(RasterConvertToDibType.BitmapInfoHeader);
}
using (RasterImage image = RasterImage.FromDibArray(dibData, 0))
{
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Image1_FromDibArray.bmp"), RasterImageFormat.Bmp, 0);
}
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}
RasterImageConverter.FromHBitmap
RasterImageConverter.ToHBitmap
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document