Corel Metafile Exchange (CMX) is a metafile format that supports bitmap and vector information and the full range of PANTONE, RGB and CMYK colors. This format is used for data exchange in programs that work with vector graphics. It contains image data and also the metadata that describes it. The purpose of this post is to demonstrate how you can export the existing CMX file to other formats (PNG, JPEG, BMP, TIFF) using Aspose.Imaging.

Convert CMX to PNG in C#

Using Aspose.Imaging.ImageOptions.PngOptions class you can export existing CMX file to PNG format. CmxRasterizationOptions class is used to set different properties as per requirement.

Using CmxRasterizationOptions.Positioning parameter, you can set the Positioning and size-types of a graphics scene. CmxRasterizationOptions.Positioning parameter can take one of the following three values.

ValueDescription
DefinedByDocumentThe absolute positioning on the page that is defined by document page settings.
DefinedByOptionsThe absolute positioning on the page that is defined by options page settings.
RelativeThe relative positioning and size. Determined by the boundary of all graphics objects.

CmxRasterizationOptions.SmoothingMode parameter specifies whether smoothing (antialiasing) is applied to lines and curves and the edges of filled areas. CmxRasterizationOptions.SmoothingMode parameter can take one of the following six values.

ValueDescription
InvalidSpecifies an invalid mode.
DefaultSpecifies no antialiasing.
HighSpeedSpecifies no antialiasing.
NoneSpecifies no antialiasing
AntiAliasSpecifies antialiased rendering.
HighQualitySpecifies antialiased rendering.

The following code is loading existing CMX files using Image class and setting Positioning to DefinedByDocument and SmoothingMode to AntiAlias and exporting loaded CMX file to PNG.

Finally, after exporting the CMX file to PNG, the output PNG looks as follows:

CMX to PNG C#

The complete code of this post is available on GitHub.