public static RasterImage FromDibArray(
byte[] hdib,
int offset
)
public:
static RasterImage^ FromDibArray(
array<byte>^ hdib,
int offset
)
hdib
Data containing the Windows DIB.
offset
Byte offset into hdib where the data starts.
The newly created RasterImage object.
When this method is completed, there are two copies of the image in memory: the original DIB and the RasterImage it creates. Freeing one will not affect the other.
This method supports the standard DIB formats (BI_RGB and BI_BITFIELDS) as well as some FOURCC (Four Character Code) formats that some capture cards output.
These are the FOURCC that LEADTOOLS supports at the moment:
YVU9 (YUV9), I420 (YUV12), YUV2 , YV12 , IF09 , IYUV , UYVY , cyuv, YUY2, YVYU, Y41P, Y211, Y41T, Y42T.
This method does not support signed images.
For more information on DDBs and DIBs, refer to Using DIBs, DDBs, and the Clipboard.
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:\LEADTOOLS22\Resources\Images";
}
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