Class EpsImage

Class EpsImage

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

The API for Encapsulated PostScript (EPS) image file format support offersrobust capabilities for manipulating compositions comprising text, graphics,and images. With features such as bitmap preview image handling, orientationflipping, bounding box retrieval for illustration bounds, resizing, rotatingimages, and adding preview images, this API ensures seamless processingand integration of EPS files into various applications with precision andversatility.

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

Inheritance

object DisposableObject DataStreamSupporter Image VectorImage EpsImage

Implements

IDisposable , IObjectWithBounds , IObjectWithSizeF

Inherited Members

VectorImage.GetDefaultOptions(object[]) , 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.

using (var image = Image.Load("AstrixObelix.eps"))
   {
       image.Resize(400, 400, ResizeType.Mitchell);
       image.Save("ExportResult.png", new PngOptions());
   }

Convert EPS image to PDF using PostScript rendering.

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.

using (var image as 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.

using (var image = Image.Load("AstrixObelix.eps"))
   {
       image.Resize(
           400,
           400,
           new ImageResizeSettings
           {
               Mode = ResizeType.LanczosResample,
               FilterType = ImageFilterType.SmallRectangular,
               ColorCompareMethod = ColorCompareMethod.Euclidian,
               ColorQuantizationMethod = ColorQuantizationMethod.Popularity
           });
       image.Save("ExportResult.png", new PngOptions());
   }

Properties

BitsPerPixel

Access the precise bit depth of the image effortlessly with this property. Retrievethe bits per pixel count, providing crucial insights into the image’s color depthand aiding in optimizing processing tasks. Ideal for applications requiringfine-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 propertyprovides crucial geometric information about the Aspose.Imaging.FileFormats.Eps.EpsImage dimensions.By retrieving this data, users can accurately assess the image’s size and aspectratio, 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.EpsImageinstance in pixels, providing essential geometric data for accurate rendering andmanipulation. 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’sinception. By accessing this information, users gain insights into the file’sorigin 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 DocumentStructuring Conventions (DSC) comments found within the EPS file. Understanding thecreator details provides insights into the software or tool used to generate theEPS file, facilitating compatibility assessment across various platforms andapplications.

[JsonProperty]
   public string Creator
   {
      get;
   }

Property Value

string

EpsType

Access and interpret the subtype value of your EPS image, streamlining yourworkflow and enhancing compatibility across platforms. Ideal for optimizing EPSsubtype 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 essentialinformation about the format of your image file, facilitating compatibility andefficient processing. Ideal for identifying the format of your image files forseamless integration into your projects.

public override FileFormat
    Get
    {
        get;
    }

Property Value

FileFormat

HasRasterPreview

Discover the presence of a raster preview effortlessly with this property. Accessthe boolean value indicating whether the Aspose.Imaging.FileFormats.Eps.EpsImage instance includes araster preview, empowering your image processing tasks with clarity and efficiency.Ideal for streamlining workflow decisions based on the presence or absence ofraster 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 withease, enabling seamless layout adjustments, aspect ratio calculations, and preciserendering 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 currentlycached, eliminating the need for additional data reading. It offers a quick andefficient 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 theAspose.Imaging.FileFormats.Eps.EpsImage instance. It offers insight into the specific PostScriptlanguage version utilized within the EPS file, aiding in compatibility assessmentand facilitating seamless integration with PostScript-compatible environments.

public string PostScriptVersion
    {
        get;
    }

Property Value

string

PreviewImageCount

Access the number of preview images available with ease. This property allows youto effortlessly retrieve the count of preview images associated with your file,enabling efficient management and navigation of your image previews. Ideal foroptimizing 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 providesseamless access to the collection of preview images, allowing you to efficientlybrowse and manage them as needed. Ideal for quickly previewing and selecting theright image for your project.

public Image[] PreviewImages
   {
      get;
   }

Property Value

Image []

Title

This property retrieves the title extracted from the EPS Document StructuringConventions (DSC) comments embedded within the EPS file. It provides valuablemetadata about the content of the EPS file, aiding in document organization andidentification within compatible software applications.

public string Title
   {
       get
       {
           return this.Title;
       }
   }

Property Value

string

WidthF

Retrieve the width of the image with this convenient property. Obtain the image’swidth effortlessly, facilitating precise layout calculations, scaling operations,and dimension-related tasks within your application. Ideal for ensuring accuraterendering 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 theAspose.Imaging.FileFormats.Eps.EpsImage class does not involve caching data. While it may notperform any action, understanding this behavior is crucial for developers workingwith EPS images, ensuring efficient resource management and optimal performancewithin their applications.

public override void CacheData()
   {
   }

~EpsImage()

protected ~EpsImage()
   {
   }

GetPreviewImage(EpsPreviewFormat)

Retrieves the existing preview image in the specified format’ orreturns null if none is found. This method offers flexibility inaccessing preview images tailored to specific formats, optimizing compatibility andresource management within applications.

public Image GetPreviewImage(
        EpsPreviewFormat format = EpsPreviewFormat.Default)
In this case, your input C# code is already formatted according to standard conventions. To improve readability, let's add line breaks between the method name and opening parenthesis, as well as between parameters and their types:
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, allowingseamless retrieval for inspection or utilization in applications. This methodprovides convenient access to preview images, enhancing user interaction with theimage data.

public IEnumerable<Image> GetPreviewImages()
   {
   }

Returns

IEnumerable < Image >

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()
   {
      base.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 differentplatforms 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

 English