public static IntPtr ChangeToEmf(
RasterImage image
)
image
The source image.
A handle to the Windows enhanced metafile (EMF) 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 enhanced metafile bitmap and copies the Leadtools.RasterImage object to the enhanced metafile.
When you no longer need the enhanced metafile, you can free it using the Windows DeleteEnhMetaFile 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 ChangeFromEmfExample()
{
RasterCodecs codecs = new RasterCodecs();
IntPtr hemf;
// Load an image
using (RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Image1.cmp"), 24, CodecsLoadByteOrder.BgrOrGray, 1, 1))
{
// Change to EMF
hemf = RasterImageConverter.ChangeToEmf(image);
}
// Convert the EMF back to a RasterImage preserving the size
using (RasterImage image = RasterImageConverter.ChangeFromEmf(hemf, 0, 0))
{
// Save it to disk
codecs.Save(image, Path.Combine(LEAD_VARS.ImagesDir, "Image1_ChangeToEmf.bmp"), RasterImageFormat.Bmp, 24);
}
// Clean up
codecs.Dispose();
}
static class LEAD_VARS
{
public const string ImagesDir = @"C:\LEADTOOLS23\Resources\Images";
}