EpsImage

EpsImage class

Base class for EPS format

public abstract class EpsImage : VectorImage

Properties

Name Description
AutoAdjustPalette { get; set; } Gets or sets a value indicating whether automatic adjust palette.
virtual BackgroundColor { get; set; } Gets or sets a value for the background color.
override BitsPerPixel { get; } Gets the image bits per pixel count.
BoundingBoxBottomLeft { get; } Gets the bounding box bottom left position
BoundingBoxString { get; } Gets the BoundingBox string value
BoundingBoxTopRight { get; } Gets the bounding box top right position
Bounds { get; } Gets the image bounds.
BufferSizeHint { get; set; } Gets or sets the buffer size hint which is defined max allowed size for all internal buffers.
Container { get; } Gets the Image container.
CreationDate { get; } Gets the CreationDate field
CreationDateString { get; } Gets he CreationDate field string value
Creator { get; } Gets the Creator field
DataStreamContainer { get; } Gets the object’s data stream.
Disposed { get; } Gets a value indicating whether this instance is disposed.
abstract EpsType { get; } Gets EPS subtype value
override FileFormat { get; } Gets a value of file format
virtual HasBackgroundColor { get; set; } Gets or sets a value indicating whether image has background color.
abstract HasRasterPreview { get; } Gets a value indicating whether this instance has format-specific raster preview
override Height { get; } Gets the image height.
virtual HeightF { get; } Gets the object height, in inches.
InterruptMonitor { get; set; } Gets or sets the interrupt monitor.
override IsCached { get; } Gets a value indicating whether object’s data is cached currently and no data reading is required.
PageNumber { get; } Gets the page number
PagesCount { get; } Gets the pages count
Palette { get; set; } Gets or sets the color palette. The color palette is not used when pixels are represented directly.
PhotoshopThumbnail { get; } Gets Photoshop preview thumbnail (if it’s present in initial EPS data)
PostScriptVersion { get; } Gets the PostScript version field
Size { get; } Gets the image size.
SizeF { get; } Gets the object size, in inches.
Title { get; } Gets the Title field
virtual UsePalette { get; } Gets a value indicating whether the image palette is used.
override Width { get; } Gets the image width.
virtual WidthF { get; } Gets the object width, in inches.

Methods

Name Description
override CacheData() Cache can not be used.
CanSave(ImageOptionsBase) Determines whether image can be saved to the specified file format represented by the passed save options.
Dispose() Disposes the current instance.
override GetDefaultOptions(object[]) Gets the default options.
virtual GetEmbeddedImages() Gets the embedded images.
virtual GetOriginalOptions() Gets the options based on the original file settings. This can be helpful to keep bit-depth and other parameters of the original image unchanged. For example, if we load a black-white PNG image with 1 bit per pixel and then save it using the Save method, the output PNG image with 8-bit per pixel will be produced. To avoid it and save PNG image with 1-bit per pixel, use this method to get corresponding saving options and pass them to the Save method as the second parameter.
Resize(int, int) Resizes the image. The default NearestNeighbourResample is used.
override Resize(int, int, ImageResizeSettings) Resizes the image.
override Resize(int, int, ResizeType) Resizes the image.
ResizeHeightProportionally(int) Resizes the height proportionally. The default NearestNeighbourResample is used.
virtual ResizeHeightProportionally(int, ImageResizeSettings) Resizes the height proportionally.
virtual ResizeHeightProportionally(int, ResizeType) Resizes the height proportionally.
ResizeWidthProportionally(int) Resizes the width proportionally. The default NearestNeighbourResample is used.
virtual ResizeWidthProportionally(int, ImageResizeSettings) Resizes the width proportionally.
virtual ResizeWidthProportionally(int, ResizeType) Resizes the width proportionally.
override RotateFlip(RotateFlipType) Rotates, flips, or rotates and flips the image.
Save() Saves the image data to the underlying stream.
Save(Stream) Saves the object’s data to the specified stream.
override Save(string) Saves the image to the specified file location.
Save(Stream, ImageOptionsBase) Saves the image’s data to the specified stream in the specified file format according to save options.
virtual Save(string, bool) Saves the object’s data to the specified file location.
virtual Save(string, ImageOptionsBase) Saves the object’s data to the specified file location in the specified file format according to save options.
virtual Save(Stream, ImageOptionsBase, Rectangle) Saves the image’s data to the specified stream in the specified file format according to save options.
virtual Save(string, ImageOptionsBase, Rectangle) Saves the object’s data to the specified file location in the specified file format according to save options.
override SetPalette(IColorPalette, bool) Sets the image palette.

Examples

Resize EPS image and export it to PNG format.

[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.

[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.

[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.

[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());
}

See Also