ToDib Method (original) (raw)
Summary
Gets an unmanaged pointer containing a Windows Device Independent Bitmap (DIB) version of this image.
Syntax
C#
Objective-C
C++/CLI
Python
- (nullable LTHandle *)toDib:(LTRasterConvertToDibType)type
Parameters
type
Type of DIB to create.
Return Value
A handle to the Windows DIB.
Example
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 ToDibExample()
{
RasterCodecs codecs = new RasterCodecs();
IntPtr dib;
using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp")))
{
dib = image.ToDib(RasterConvertToDibType.BitmapInfoHeader);
}
using (RasterImage image = RasterImage.FromDib(dib))
{
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Image1_FromDib.bmp"), RasterImageFormat.Bmp, 0);
}
Marshal.FreeHGlobal(dib);
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS22\Resources\Images";
}
Leadtools Assembly