Class EpsImage

Class EpsImage

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

The API for Encapsulated PostScript (EPS) image file format support offers robust capabilities for manipulating compositions comprising text, graphics, and images. With features such as bitmap preview image handling, orientation flipping, bounding box retrieval for illustration bounds, resizing, rotating images, and adding preview images, this API ensures seamless processing and integration of EPS files into various applications with precision and versatility.

[JsonObject(MemberSerialization.OptIn)]
public sealed class EpsImage : VectorImage, IDisposable, IObjectWithBounds, IObjectWithSizeF

Inheritance

objectDisposableObjectDataStreamSupporterImageVectorImageEpsImage

Implements

IDisposable, IObjectWithBounds, IObjectWithSizeF

Inherited Members

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.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.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.CacheData(), DataStreamSupporter.Save(), DataStreamSupporter.Save(Stream), DataStreamSupporter.Save(string), DataStreamSupporter.Save(string, bool), DataStreamSupporter.DataStreamContainer, DataStreamSupporter.IsCached, DisposableObject.Dispose(), DisposableObject.Disposed, object.GetType(), object.ToString(), object.Equals(object?), object.Equals(object?, object?), object.ReferenceEquals(object?, object?), object.GetHashCode()

Examples

Resize EPS image and export it to PNG format.```csharp [C#]

                                                    // Load EPS image
                                                    using (var image = Image.Load("AstrixObelix.eps"))
                                                    {
                                                        // Resize the image using the Mitchell cubic interpolation method
                                                        image.Resize(400, 400, ResizeType.Mitchell);

                                                        // Export image to PNG format
                                                        image.Save("ExportResult.png", new PngOptions());
                                                    }

Convert EPS image to PDF using PostScript rendering.```csharp
[C#]

                                                               using (var image = (EpsImage)Image.Load("Sample.eps"))
                                                               {
                                                                   var options = new PdfOptions
                                                                   {
                                                                       PdfCoreOptions = new PdfCoreOptions
                                                                       {
                                                                           PdfCompliance = PdfComplianceVersion.PdfA1b // Set required PDF compliance
                                                                       }
                                                                   };

                                                                   image.Save("Sample.pdf", options);
                                                               }

Convert EPS image to PNG using PostScript rendering.```csharp [C#]

                                                           using (var image = (EpsImage)Image.Load("Sample.eps"))
                                                           {
                                                               var options = new PngOptions
                                                               {
                                                                   VectorRasterizationOptions = new EpsRasterizationOptions
                                                                   {
                                                                       PageWidth = 500, // Image width
                                                                       PageHeight = 500 // Image height
                                                                       PreviewToExport = EpsPreviewFormat.PostScriptRendering; // Render raster image using the PostScript
                                                                   }
                                                               };

                                                               image.Save("Sample.png", options);
                                                           }

Resize EPS image using advanced settings.```csharp
[C#]

                                                    // Load EPS image
                                                    using (var image = Image.Load("AstrixObelix.eps"))
                                                    {
                                                        // Resize the image using advanced resize settings
                                                        image.Resize(400, 400, new ImageResizeSettings
                                                        {
                                                            // Set the interpolation mode
                                                            Mode = ResizeType.LanczosResample,

                                                            // Set the type of the filter
                                                            FilterType = ImageFilterType.SmallRectangular,

                                                            // Sets the color compare method
                                                            ColorCompareMethod = ColorCompareMethod.Euclidian,

                                                            // Set the color quantization method
                                                            ColorQuantizationMethod = ColorQuantizationMethod.Popularity
                                                        });

                                                        // Export image to PNG format
                                                        image.Save("ExportResult.png", new PngOptions());
                                                    }

Properties

BitsPerPixel

Access the precise bit depth of the image effortlessly with this property. Retrieve the bits per pixel count, providing crucial insights into the image’s color depth and aiding in optimizing processing tasks. Ideal for applications requiring fine-grained control over image manipulation and analysis.

public override int BitsPerPixel { get; }

Property Value

int

Exceptions

NotSupportedException

BoundingBox

Accessing the original bounding box in device-independent points, this property provides crucial geometric information about the Aspose.Imaging.FileFormats.Eps.EpsImage dimensions. By retrieving this data, users can accurately assess the image’s size and aspect ratio, facilitating precise layout and positioning in various applications.

public RectangleF BoundingBox { get; }

Property Value

RectangleF

BoundingBoxPx

This property returns the original bounding box of the Aspose.Imaging.FileFormats.Eps.EpsImage instance in pixels, providing essential geometric data for accurate rendering and manipulation. With this information, users can ensure precise placement and sizing /// of EPS images in their projects, enhancing overall visual presentation and quality.

public Rectangle BoundingBoxPx { get; }

Property Value

Rectangle

CreationDate

Retrieving the creation date from EPS Document Structuring Conventions (DSC) comments, this property provides essential metadata indicating the EPS file’s inception. By accessing this information, users gain insights into the file’s origin and chronology, enhancing file management and organization.

[JsonProperty]
public DateTime CreationDate { get; }

Property Value

DateTime

Creator

This property offers access to the creator information sourced from EPS Document Structuring Conventions (DSC) comments found within the EPS file. Understanding the creator details provides insights into the software or tool used to generate the EPS file, facilitating compatibility assessment across various platforms and applications.

[JsonProperty]
public string Creator { get; }

Property Value

string

EpsType

Access and interpret the subtype value of your EPS image, streamlining your workflow and enhancing compatibility across platforms. Ideal for optimizing EPS subtype retrieval in your projects with precision and efficiency.

public EpsType EpsType { get; }

Property Value

EpsType

FileFormat

Access the file format of your image with this property. Retrieve essential information about the format of your image file, facilitating compatibility and efficient processing. Ideal for identifying the format of your image files for seamless integration into your projects.

public override FileFormat FileFormat { get; }

Property Value

FileFormat

HasRasterPreview

Discover the presence of a raster preview effortlessly with this property. Access the boolean value indicating whether the Aspose.Imaging.FileFormats.Eps.EpsImage instance includes a raster preview, empowering your image processing tasks with clarity and efficiency. Ideal for streamlining workflow decisions based on the presence or absence of raster previews in EPS images.

public bool HasRasterPreview { get; }

Property Value

bool

HeightF

Access the height of the image using this property. Obtain the image’s height with ease, enabling seamless layout adjustments, aspect ratio calculations, and precise rendering across different screen resolutions and display environments.

public override float HeightF { get; }

Property Value

float

IsCached

This property provides a convenient way to check if the object’s data is currently cached, eliminating the need for additional data reading. It offers a quick and efficient method to determine if the required information is readily available, optimizing performance and reducing resource overhead in data-intensive operations.

public override bool IsCached { get; }

Property Value

bool

PostScriptVersion

This property retrieves the PostScript version associated with the Aspose.Imaging.FileFormats.Eps.EpsImage instance. It offers insight into the specific PostScript language version utilized within the EPS file, aiding in compatibility assessment and facilitating seamless integration with PostScript-compatible environments.

[JsonProperty]
public string PostScriptVersion { get; }

Property Value

string

PreviewImageCount

Access the number of preview images available with ease. This property allows you to effortlessly retrieve the count of preview images associated with your file, enabling efficient management and navigation of your image previews. Ideal for optimizing your workflow and organizing your image assets effectively.

public int PreviewImageCount { get; }

Property Value

int

PreviewImages

Retrieve the preview images associated with your file. This property provides seamless access to the collection of preview images, allowing you to efficiently browse and manage them as needed. Ideal for quickly previewing and selecting the right image for your project.

public Image[] PreviewImages { get; }

Property Value

Image[]

Title

This property retrieves the title extracted from the EPS Document Structuring Conventions (DSC) comments embedded within the EPS file. It provides valuable metadata about the content of the EPS file, aiding in document organization and identification within compatible software applications.

[JsonProperty]
public string Title { get; }

Property Value

string

WidthF

Retrieve the width of the image with this convenient property. Obtain the image’s width effortlessly, facilitating precise layout calculations, scaling operations, and dimension-related tasks within your application. Ideal for ensuring accurate rendering and display of images across various platforms and devices.

public override float WidthF { get; }

Property Value

float

Methods

CacheData()

This method does nothing as the current implementation of the Aspose.Imaging.FileFormats.Eps.EpsImage class does not involve caching data. While it may not perform any action, understanding this behavior is crucial for developers working with EPS images, ensuring efficient resource management and optimal performance within their applications.

public override void CacheData()

~EpsImage()

protected ~EpsImage()

GetDefaultOptions(object[])

Retrieve default options effortlessly to streamline image processing tasks. Access preconfigured settings to expedite workflow and ensure consistent output quality without manual configuration.

public override ImageOptionsBase GetDefaultOptions(object[] args)

Parameters

args object[]

The arguments.

Returns

ImageOptionsBase

Default options

GetPreviewImage(EpsPreviewFormat)

Retrieves the existing preview image in the specified format or returns null if none is found. This method offers flexibility in accessing preview images tailored to specific formats, optimizing compatibility and resource management within applications.

public Image GetPreviewImage(EpsPreviewFormat format = EpsPreviewFormat.Default)

Parameters

format EpsPreviewFormat

The EPS preview image format.

Returns

Image

The exisiting preview image or null.

Exceptions

ArgumentOutOfRangeException

GetPreviewImages()

Accesses the preview images linked to the Aspose.Imaging.FileFormats.Eps.EpsImage instance, allowing seamless retrieval for inspection or utilization in applications. This method provides convenient access to preview images, enhancing user interaction with the image data.

public IEnumerable<image/> GetPreviewImages()

Returns

IEnumerable<Image&gt;

The preview images.

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 image palettes to achieve unique color schemes and enhance visual appeal. Tailor colors for specific effects and optimize image quality across different platforms and devices with ease.

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.

Exceptions

NotSupportedException

Not supported by VectorImage