Class WmfImage
- Namespace
- Aspose.Imaging.FileFormats.Wmf
- Assembly
- Aspose.Imaging.dll
Manipulate Microsoft Windows Metafile (WMF) images with our API, seamlessly handling both vector and bitmap data stored within variable-length records. Resize, rotate, and flip images with ease while setting custom image palettes. Convert WMF files to compressed WMZ formats or save them in raster image formats for versatile usage across platforms and applications.
public class WmfImage : MetaImage, IDisposable, IObjectWithBounds, IObjectWithSizeF
- Inheritance
-
WmfImage
- Implements
- Inherited Members
Constructors
WmfImage()
Create a new instance of the WmfImage class, initializing it for further manipulation and processing of Windows Metafile (WMF) image data. This constructor provides a foundational object for working with WMF images, enabling seamless integration of WMF image handling capabilities into your application's functionality.
public WmfImage()
WmfImage(int, int)
Instantiate a new instance of the WmfImage class with customizable width and height parameters, facilitating the creation of blank WMF images tailored to specific dimensions. Utilize this constructor to dynamically generate WMF images with precise dimensions, enabling flexible image creation and manipulation within your application.
public WmfImage(int width, int height)
Parameters
Properties
BitsPerPixel
Retrieve the count of bits per pixel for the image, indicating the level of color depth or granularity. Utilize this property to determine the image's color representation and precision, facilitating compatibility checks and color-related processing within your application.
public override int BitsPerPixel { get; }
Property Value
- int
The image bits per pixel count.
Exceptions
FileFormat
Access the file format value associated with the image, providing information about the format in which the image is stored. Utilize this property to determine the file format of the image, facilitating compatibility checks and format-specific processing within your application.
public override FileFormat FileFormat { get; }
Property Value
FrameBounds
Access the bounds of the frame, indicating its position and dimensions within the image. Utilize this property to retrieve detailed information about the frame's spatial location, enabling precise manipulation and rendering within your application.
public Rectangle FrameBounds { get; }
Property Value
- Rectangle
The frame bounds.
Height
Access the image's height, representing the number of pixels along its vertical axis. Utilize this property to ascertain the image's spatial dimensions and aspect ratio, enabling accurate layout and rendering adjustments within your application.
public override int Height { get; }
Property Value
- int
The image height.
Exceptions
Inch
Access or modify the inch property, representing a unit of measurement typically used for specifying physical dimensions in print or display contexts. Utilize this property to establish or retrieve inch values associated with the image, facilitating accurate representation of physical dimensions within your application.
public int Inch { get; set; }
Property Value
- int
The inch.
IsCached
Retrieve a boolean value indicating whether the object's data is currently cached, eliminating the need for additional data reading operations. Utilize this property to optimize performance by determining if the object's data is readily available without the need for costly data retrieval processes within your application.
public override bool IsCached { get; }
Property Value
- bool
true
if object's data is cached; otherwise,false
.
Exceptions
Width
Access the width of the image, indicating the number of pixels along its horizontal axis. Utilize this property to determine the image's spatial dimensions and aspect ratio, enabling precise layout and rendering adjustments within your application.
public override int Width { get; }
Property Value
- int
The image width.
Exceptions
Methods
AddRecord(WmfObject)
Incorporate the specified record object into the image, enriching its content with additional data or metadata. Utilize this method to seamlessly integrate record objects into the image, facilitating comprehensive data storage and organization within your application.
public int AddRecord(WmfObject record)
Parameters
record
WmfObjectThe record.
Returns
- int
Number of record.
CacheData()
Efficiently cache the data, eliminating the need for additional loading from the underlying DataStreamContainer. Utilize this method to optimize performance and minimize resource usage within your application by storing and accessing local data cache.
public override void CacheData()
Exceptions
Crop(Rectangle)
Crop the image to the specified rectangle, retaining only the selected region while discarding the rest. Integrate this method into your image processing workflow to extract specific areas of interest and customize the composition of the image within your application.
public override void Crop(Rectangle rectangle)
Parameters
rectangle
RectangleThe rectangle.
GetDefaultOptions(object[])
Retrieve the default options associated with the image, providing access to predefined settings or configurations. Utilize this method to access default settings for image processing operations, facilitating consistency and convenience within your application's functionality.
public override ImageOptionsBase GetDefaultOptions(object[] args)
Parameters
args
object[]The arguments.
Returns
- ImageOptionsBase
Default options
GetPostScript()
Access the PostScript data associated with the image, providing detailed information about its structure or content. Utilize this method to retrieve PostScript data for further analysis or processing within your application, enabling advanced functionality related to PostScript rendering or manipulation.
public string GetPostScript()
Returns
- string
The post script
GetUsedFonts()
Retrieve the list of fonts used within the metafile, providing insight into the font resources utilized in the image. Utilize this method to analyze font usage and ensure font availability for rendering or further processing within your application.
public override string[] GetUsedFonts()
Returns
- string[]
The font list
Resize(int, int, ImageResizeSettings)
Adjust the size of the image based on specified settings, enabling precise control over dimensions, aspect ratio, and scaling behavior. Integrate this method into your image processing workflow to achieve customized resizing operations tailored to the specific requirements of your application.
public override void Resize(int newWidth, int newHeight, ImageResizeSettings settings)
Parameters
newWidth
intThe new width.
newHeight
intThe new height.
settings
ImageResizeSettingsThe resize settings.
Exceptions
Resize(int, int, ResizeType)
Resize the image with the specified resizing type, allowing for flexible adjustment of dimensions while preserving aspect ratio or applying specific scaling algorithms. Integrate this method into your image processing workflow to achieve precise resizing operations tailored to your application's requirements.
public override void Resize(int newWidth, int newHeight, ResizeType resizeType)
Parameters
newWidth
intThe new width.
newHeight
intThe new height.
resizeType
ResizeTypeThe resize type.
Exceptions
ResizeCanvas(Rectangle)
Resize the canvas of the image, adjusting its dimensions while retaining the image content. Utilize this method to modify the size of the canvas without altering the content, facilitating layout adjustments and composition changes within your application.
public override void ResizeCanvas(Rectangle newRectangle)
Parameters
newRectangle
RectangleThe new rectangle.
Exceptions
RotateFlip(RotateFlipType)
Perform rotation, flipping, or a combination of both operations on the image. Integrate this method into your image processing workflow to achieve precise manipulation of image orientation and alignment within your application.
public override void RotateFlip(RotateFlipType rotateFlipType)
Parameters
rotateFlipType
RotateFlipTypeType of the rotate flip.
Exceptions
SaveData(Stream)
Saves the data.
protected override void SaveData(Stream stream)
Parameters
stream
StreamThe stream to save data to.
Exceptions
SetPalette(IColorPalette, bool)
Apply a specified palette to the image, enabling customization of color representation. Utilize this method to enhance visual rendering and achieve specific color effects within your application.
public override void SetPalette(IColorPalette palette, bool updateColors)
Parameters
palette
IColorPaletteThe palette to set.
updateColors
boolif 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.