public class CmxImage extends VectorMultipageImage implements ICmxImage
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.
ImageThe following example shows how to cache all pages of a CMX image.
String dir = "c:\\temp\\";
// Load an image from a CMX file.
com.aspose.imaging.fileformats.cmx.CmxImage image = (com.aspose.imaging.fileformats.cmx.CmxImage) com.aspose.imaging.Image.load(dir + "sample.cmx");
try {
// 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.
for (com.aspose.imaging.fileformats.cmx.CmxImagePage page : image.getPages()) {
page.cacheData();
}
} finally {
image.dispose();
}
| Constructor and Description |
|---|
CmxImage(StreamContainer streamContainer,
LoadOptions loadOptions)
Start working with the
CmxImage class seamlessly by initializing
a new instance with a streamContainer and loadOptions parameters. |
| Modifier and Type | Method and Description |
|---|---|
void |
cacheData()
Cache the data to prevent additional loading from the underlying source
DataStreamSupporter
with this convenient method. |
int |
getBitsPerPixel()
Retrieve the bit depth of the image effortlessly with this user-friendly property.
|
CmxPage |
getCmxPage()
Effortlessly retrieve the CMX page of the image with this intuitive property.
|
Image |
getDefaultPage()
Deprecated.
Please use getPages()[index]
|
CmxDocument |
getDocument()
Retrieve the CMX document effortlessly with this intuitive property.
|
long |
getFileFormat()
Retrieve the file format of the image effortlessly with this user-friendly property.
|
float |
getHeightF()
Effortlessly obtain the height of the object, measured in inches, with this
user-friendly property.
|
int |
getPageCount()
Retrieve the total page count of the image with this intuitive property.
|
Image[] |
getPages()
Retrieve the pages of the image seamlessly with this intuitive property.
|
float |
getWidthF()
Retrieve the width of the object in inches with this intuitive property.
|
boolean |
isCached()
Determine whether the object's data is currently cached, eliminating the need
for data reading.
|
void |
setPalette(IColorPalette palette,
boolean updateColors)
Customize the color palette of the image with this intuitive method.
|
crop, getEmbeddedImages, getHeight, getPageExportingAction, getWidth, removeBackground, removeBackground, resize, resize, rotate, rotateFlip, setPageExportingActiongetDefaultOptions, getSizeFcanLoad, canLoad, canLoad, canLoad, canSave, create, create, create, create, create, create, crop, getBackgroundColor, getBounds, getBufferSizeHint, getContainer, getFileFormat, getFileFormat, getFittingRectangle, getFittingRectangle, getInterruptMonitor, getIProgressEventHandler, getOriginalOptions, getPalette, getProgressEventHandlerInfo, getProportionalHeight, getProportionalWidth, getSerializedStream, getSize, hasBackgroundColor, isAutoAdjustPalette, isUsePalette, load, load, load, load, load, load, removeMetadata, resize, resizeHeightProportionally, resizeHeightProportionally, resizeHeightProportionally, resizeWidthProportionally, resizeWidthProportionally, resizeWidthProportionally, save, save, save, save, save, save, save, save, setAutoAdjustPalette, setBackgroundColor, setBackgroundColor, setBufferSizeHint, setInterruptMonitor, setPalettegetDataStreamContainer, save, save, saveclose, dispose, getDisposedequals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetSizeFpublic CmxImage(StreamContainer streamContainer, LoadOptions loadOptions)
Start working with the 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.
streamContainer - The stream container.loadOptions - The load options.public long getFileFormat()
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.
getFileFormat in class ImageFileFormat.CmxFileFormatpublic int getBitsPerPixel()
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.
getBitsPerPixel in class VectorMultipageImage@Deprecated public Image getDefaultPage()
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.
getDefaultPage in class VectorMultipageImageCmxImage.getPages()public boolean 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.
isCached in class VectorMultipageImagetrue if object's data is cached; otherwise, false.public float getWidthF()
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.
getWidthF in interface IObjectWithSizeFgetWidthF in class VectorImagepublic float getHeightF()
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.
getHeightF in interface IObjectWithSizeFgetHeightF in class VectorImagepublic final CmxDocument getDocument()
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 final CmxPage getCmxPage()
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.
getCmxPage in interface ICmxImagepublic int getPageCount()
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.
getPageCount in interface IMultipageImagepublic Image[] getPages()
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.
getPages in interface IMultipageImageThe following example shows how to cache all pages of a CMX image.
String dir = "c:\\temp\\";
// Load an image from a CMX file.
com.aspose.imaging.fileformats.cmx.CmxImage image = (com.aspose.imaging.fileformats.cmx.CmxImage) com.aspose.imaging.Image.load(dir + "sample.cmx");
try {
// 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.
for (com.aspose.imaging.fileformats.cmx.CmxImagePage page : image.getPages()) {
page.cacheData();
}
} finally {
image.dispose();
}
public void cacheData()
Cache the data to prevent additional loading from the underlying source
DataStreamSupporter
with this convenient method. Ideal for developers seeking to optimize performance
by preloading data, ensuring faster access and smoother operation in their applications.
cacheData in class VectorMultipageImageThe following example shows how to cache all pages of a CMX image.
String dir = "c:\\temp\\";
// Load an image from a CMX file.
com.aspose.imaging.fileformats.cmx.CmxImage image = (com.aspose.imaging.fileformats.cmx.CmxImage) com.aspose.imaging.Image.load(dir + "sample.cmx");
try {
// 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.
for (com.aspose.imaging.fileformats.cmx.CmxImagePage page : image.getPages()) {
page.cacheData();
}
} finally {
image.dispose();
}
public void setPalette(IColorPalette palette, boolean updateColors)
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.
setPalette in class VectorMultipageImagepalette - The palette to set.updateColors - 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.Copyright (c) 2008-2025 Aspose Pty Ltd. All Rights Reserved.