Class CmxImage

Class CmxImage

Namespace: Aspose.Imaging.FileFormats.Cmx
Assembly: Aspose.Imaging.dll (25.2.0)

The API for Corel Metafile Exchange (CMX) vector image format with metadata descriptions support is a comprehensive solution for developers working with CMX files. This API allows for the seamless loading of CMX images, extracting metadata such as bits per pixel, object dimensions, and more. With additional functionalities like resizing, rotating, setting palettes, and converting to other formats, this API empowers developers to efficiently manipulate and customize CMX vector images to meet their specific application requirements.

[JsonObject(MemberSerialization.OptIn)]
public class CmxImage : VectorMultipageImage, IDisposable, IObjectWithBounds, IMultipageImage, ICmxImage, IObjectWithSizeF

Inheritance

objectDisposableObjectDataStreamSupporterImageVectorImageVectorMultipageImageCmxImage

Implements

IDisposable, IObjectWithBounds, IMultipageImage, ICmxImage, IObjectWithSizeF

Inherited Members

VectorMultipageImage.CacheData(), VectorMultipageImage.Crop(Rectangle), VectorMultipageImage.Resize(int, int, ResizeType), VectorMultipageImage.Rotate(float), VectorMultipageImage.Resize(int, int, ImageResizeSettings), VectorMultipageImage.RotateFlip(RotateFlipType), VectorMultipageImage.RemoveBackground(RemoveBackgroundSettings), VectorMultipageImage.RemoveBackground(), VectorMultipageImage.SetPalette(IColorPalette, bool), VectorMultipageImage.GetEmbeddedImages(), VectorMultipageImage.SaveData(Stream), VectorMultipageImage.GetSerializedStream(ImageOptionsBase, Rectangle, out int), VectorMultipageImage.ReleaseManagedResources(), VectorMultipageImage.PageCount, VectorMultipageImage.Pages, VectorMultipageImage.DefaultPage, VectorMultipageImage.IsCached, VectorMultipageImage.BitsPerPixel, VectorMultipageImage.Width, VectorMultipageImage.Height, VectorMultipageImage.PageExportingAction, VectorImage.GetEmbeddedImages(), VectorImage.RemoveBackground(), VectorImage.RemoveBackground(RemoveBackgroundSettings), VectorImage.Resize(int, int, ResizeType), VectorImage.Resize(int, int, ImageResizeSettings), VectorImage.RotateFlip(RotateFlipType), VectorImage.Crop(Rectangle), VectorImage.Rotate(float), VectorImage.Modify(RectangleF, float, float, float), VectorImage.SizeF, VectorImage.WidthF, VectorImage.HeightF, VectorImage.Width, VectorImage.Height, Image.CanLoad(string), Image.CanLoad(string, LoadOptions), Image.CanLoad(Stream), Image.CanLoad(Stream, LoadOptions), Image.Create(ImageOptionsBase, int, int), Image.Create(Image[]), Image.Create(MultipageCreateOptions), Image.Create(string[], bool), Image.Create(string[]), Image.Create(Image[], bool), Image.GetFileFormat(string), Image.GetFileFormat(Stream), Image.GetFittingRectangle(Rectangle, int, int), Image.GetFittingRectangle(Rectangle, int[], int, int), Image.Load(string, LoadOptions), Image.Load(string), Image.Load(Stream, LoadOptions), Image.Load(Stream), Image.GetProportionalWidth(int, int, int), Image.GetProportionalHeight(int, int, int), Image.RemoveMetadata(), Image.CanSave(ImageOptionsBase), Image.Resize(int, int), Image.Resize(int, int, ResizeType), Image.Resize(int, int, ImageResizeSettings), Image.GetDefaultOptions(object[]), Image.GetOriginalOptions(), Image.ResizeWidthProportionally(int), Image.ResizeHeightProportionally(int), Image.ResizeWidthProportionally(int, ResizeType), Image.ResizeHeightProportionally(int, ResizeType), Image.ResizeWidthProportionally(int, ImageResizeSettings), Image.ResizeHeightProportionally(int, ImageResizeSettings), Image.RotateFlip(RotateFlipType), Image.Rotate(float), Image.Crop(Rectangle), Image.Crop(int, int, int, int), Image.Save(), Image.Save(string), Image.Save(string, ImageOptionsBase), Image.Save(string, ImageOptionsBase, Rectangle), Image.Save(Stream, ImageOptionsBase), Image.Save(Stream, ImageOptionsBase, Rectangle), Image.GetSerializedStream(ImageOptionsBase, Rectangle, out int), Image.SetPalette(IColorPalette, bool), Image.UpdateContainer(Image), Image.GetCanNotSaveMessage(ImageOptionsBase), Image.GetFitRectangle(Rectangle), Image.GetImage2Export(ImageOptionsBase, Rectangle, IImageExporter), Image.GetFitRectangle(Rectangle, int[]), Image.OnPaletteChanged(IColorPalette, IColorPalette), Image.OnPaletteChanging(IColorPalette, IColorPalette), Image.ReleaseManagedResources(), Image.BitsPerPixel, Image.Bounds, Image.Container, Image.Height, Image.Palette, Image.UsePalette, Image.Size, Image.Width, Image.InterruptMonitor, Image.BufferSizeHint, Image.AutoAdjustPalette, Image.HasBackgroundColor, Image.FileFormat, Image.BackgroundColor, DataStreamSupporter.timeout, DataStreamSupporter.CacheData(), DataStreamSupporter.Save(), DataStreamSupporter.Save(Stream), DataStreamSupporter.Save(string), DataStreamSupporter.Save(string, bool), DataStreamSupporter.SaveData(Stream), DataStreamSupporter.ReleaseManagedResources(), DataStreamSupporter.OnDataStreamContainerChanging(StreamContainer), DataStreamSupporter.DataStreamContainer, DataStreamSupporter.IsCached, DisposableObject.Dispose(), DisposableObject.ReleaseManagedResources(), DisposableObject.ReleaseUnmanagedResources(), DisposableObject.VerifyNotDisposed(), DisposableObject.Disposed, object.GetType(), object.MemberwiseClone(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

The following example shows how to cache all pages of a CMX image.```csharp [C#]

                                                                         string dir = "c:\\temp\\";

                                                                         // Load an image from a CMX file.
                                                                         using (Aspose.Imaging.FileFormats.Cmx.CmxImage image = (Aspose.Imaging.FileFormats.Cmx.CmxImage)Aspose.Imaging.Image.Load(dir + "sample.cmx"))
                                                                         {
                                                                             // This call caches only the default page.
                                                                             image.CacheData();

                                                                             // Cache all pages so that no additional data loading will be performed from the underlying data stream.
                                                                             foreach (Aspose.Imaging.FileFormats.Cmx.CmxImagePage page in image.Pages)
                                                                             {
                                                                                 page.CacheData();
                                                                             }
                                                                         }

## Constructors

### <a id="Aspose_Imaging_FileFormats_Cmx_CmxImage__ctor_Aspose_Imaging_StreamContainer_Aspose_Imaging_LoadOptions_"></a> CmxImage\(StreamContainer, LoadOptions\)

Start working with the Aspose.Imaging.FileFormats.Cmx.CmxImage class seamlessly by initializing
a new instance with a streamContainer and loadOptions parameters. Ideal for developers
seeking a convenient way to load CMX images from various data sources while
customizing the loading process as needed.

```csharp
public CmxImage(StreamContainer streamContainer, LoadOptions loadOptions)

Parameters

streamContainer StreamContainer

The stream container.

loadOptions LoadOptions

The load options.

Properties

BitsPerPixel

Retrieve the bit depth of the image effortlessly with this user-friendly property. Ideal for developers seeking to determine the level of detail or color depth present in their images, ensuring accurate processing and manipulation.

public override int BitsPerPixel { get; }

Property Value

int

CmxPage

Effortlessly retrieve the CMX page of the image with this intuitive property. Ideal for developers seeking quick access to individual pages within CMX images, ensuring efficient navigation and management.

public CmxPage CmxPage { get; }

Property Value

CmxPage

DefaultPage

Effortlessly retrieve the default page of the image with this intuitive property. Ideal for developers seeking quick access to the primary page of their image, ensuring efficient navigation and management.

[Obsolete("Please use Pages[n]")]
public override Image DefaultPage { get; }

Property Value

Image

Document

Retrieve the CMX document effortlessly with this intuitive property. Ideal for developers seeking to access or modify CMX images, ensuring flexibility and efficiency in their applications.

public CmxDocument Document { get; }

Property Value

CmxDocument

FileFormat

Retrieve the file format of the image effortlessly with this user-friendly property. Ideal for developers seeking to determine the format of their images dynamically, ensuring compatibility and accurate processing in their applications.

public override FileFormat FileFormat { get; }

Property Value

FileFormat

HeightF

Effortlessly obtain the height of the object, measured in inches, with this user-friendly property. Ideal for developers seeking precise dimensional information for effective layout and presentation in their applications.

public override float HeightF { get; }

Property Value

float

IsCached

Determine whether the object’s data is currently cached, eliminating the need for data reading. Ideal for developers seeking to optimize performance by leveraging cached data efficiently, ensuring faster access to object information.

public override bool IsCached { get; }

Property Value

bool

PageCount

Retrieve the total page count of the image with this intuitive property. Ideal for developers seeking to manage multi-page images dynamically, ensuring efficient navigation and manipulation of image content.

public override int PageCount { get; }

Property Value

int

Pages

Retrieve the pages of the image seamlessly with this intuitive property. Ideal for developers seeking to access and manipulate individual pages within multi-page images, ensuring efficient navigation and processing.

public override Image[] Pages { get; }

Property Value

Image[]

Examples

The following example shows how to cache all pages of a CMX image.```csharp [C#]

                                                                         string dir = "c:\\temp\\";

                                                                         // Load an image from a CMX file.
                                                                         using (Aspose.Imaging.FileFormats.Cmx.CmxImage image = (Aspose.Imaging.FileFormats.Cmx.CmxImage)Aspose.Imaging.Image.Load(dir + "sample.cmx"))
                                                                         {
                                                                             // This call caches only the default page.
                                                                             image.CacheData();

                                                                             // Cache all pages so that no additional data loading will be performed from the underlying data stream.
                                                                             foreach (Aspose.Imaging.FileFormats.Cmx.CmxImagePage page in image.Pages)
                                                                             {
                                                                                 page.CacheData();
                                                                             }
                                                                         }

### <a id="Aspose_Imaging_FileFormats_Cmx_CmxImage_WidthF"></a> WidthF

Retrieve the width of the object in inches with this intuitive property.
Ideal for developers seeking precise measurements of objects in their applications,
ensuring accurate layout and presentation.

```csharp
public override float WidthF { get; }

Property Value

float

Methods

CacheData()

Cache the data to prevent additional loading from the underlying source Aspose.Imaging.DataStreamSupporter.DataStreamContainer with this convenient method. Ideal for developers seeking to optimize performance by preloading data, ensuring faster access and smoother operation in their applications.

public override void CacheData()

Examples

The following example shows how to cache all pages of a CMX image.```csharp [C#]

                                                                         string dir = "c:\\temp\\";

                                                                         // Load an image from a CMX file.
                                                                         using (Aspose.Imaging.FileFormats.Cmx.CmxImage image = (Aspose.Imaging.FileFormats.Cmx.CmxImage)Aspose.Imaging.Image.Load(dir + "sample.cmx"))
                                                                         {
                                                                             // This call caches only the default page.
                                                                             image.CacheData();

                                                                             // Cache all pages so that no additional data loading will be performed from the underlying data stream.
                                                                             foreach (Aspose.Imaging.FileFormats.Cmx.CmxImagePage page in image.Pages)
                                                                             {
                                                                                 page.CacheData();
                                                                             }
                                                                         }

### <a id="Aspose_Imaging_FileFormats_Cmx_CmxImage_GetDefaultOptions_System_Object___"></a> GetDefaultOptions\(object\[\]\)

Retrieve the default options effortlessly with this user-friendly method.
Perfect for developers seeking quick access to the default settings or configurations
associated with an object, ensuring efficient customization and streamlined workflow.

```csharp
public override ImageOptionsBase GetDefaultOptions(object[] args)

Parameters

args object[]

The arguments.

Returns

ImageOptionsBase

Default options

ReleaseManagedResources()

Releases the managed resources. Make sure no unmanaged resources are released here, since they may have been already released.

protected override void ReleaseManagedResources()

SaveData(Stream)

Saves the data.

protected override void SaveData(Stream stream)

Parameters

stream Stream

The stream to save data to.

SetPalette(IColorPalette, bool)

Customize the color palette of the image with this intuitive method. Ideal for developers seeking to apply specific color schemes or adjustments dynamically, ensuring precise control over the visual appearance of their images.

public override void SetPalette(IColorPalette palette, bool updateColors)

Parameters

palette IColorPalette

The palette to set.

updateColors bool

if set to true colors will be updated according to the new palette; otherwise color indexes remain unchanged. Note that unchanged indexes may crash the image on loading if some indexes have no corresponding palette entries.

See Also

Image