public static IntPtr ChangeToWmf(
RasterImage image
)
image
The source image.
A handle to the Windows metafile (WMF) this method creates.
This method results in only one copy of the image, and it invalidates this Leadtools.RasterImage object. You must call RasterImage.Dispose after calling this method.
This method allocates an metafile bitmap and copies the Leadtools.RasterImage object to the metafile.
When you no longer need the metafile, you can free it using the Windows DeleteMetaFile function.
This method does not support signed images.
For more information refer to RasterImage and GDI/GDI+.
using Leadtools;
using Leadtools.Codecs;
using Leadtools.Drawing;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Color;
public void ChangeFromWmfExample()
{
RasterCodecs codecs = new RasterCodecs();
IntPtr hwmf;
// Load an image
using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"), 24, CodecsLoadByteOrder.BgrOrGray, 1, 1))
{
// Change to WMF
hwmf = RasterImageConverter.ChangeToWmf(image);
}
// Convert the WMF back to a RasterImage preserving the size
using (RasterImage image = RasterImageConverter.ChangeFromWmf(hwmf, 0, 0))
{
// Save it to disk
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Image1_ChangeFromWmf.bmp"), RasterImageFormat.Bmp, 24);
}
// Clean up
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}