Packages

 

com.aspose.imaging.fileformats.eps

Class EpsImage

  • All Implemented Interfaces:
    IObjectWithSizeF, IObjectWithBounds, com.aspose.internal.progressmanagement.IProgressEventHandler, com.aspose.internal.progressmanagement.IProgressInformer, com.aspose.ms.System.IDisposable, Closeable, AutoCloseable
    Direct Known Subclasses:
    EpsBinaryImage, EpsInterchangeImage


    public abstract class EpsImage
    extends VectorImage

    Base class for EPS format

    Code example:

    Convert EPS image to PNG using PostScript rendering.


    try (EpsImage image = (EpsImage)Image.load("Sample.eps"))
    {
        PngOptions options = new PngOptions();
        EpsRasterizationOptions epsRasterizationOptions = new EpsRasterizationOptions();
        epsRasterizationOptions.setPageWidth(500);  // Image width
        epsRasterizationOptions.setPageHeight(500); // Image height
        options.setVectorRasterizationOptions(epsRasterizationOptions);
    
        image.setPreviewToExport(EpsPreviewFormat.PostScriptRendering); // Render raster image using the PostScript
        image.save("Sample.png", options);
    }
    

    • Method Detail

      • getFileFormat

        public long getFileFormat()

        Gets a value of file format

        Overrides:
        getFileFormat in class Image
      • getEpsType

        public abstract int getEpsType()

        Gets EPS subtype value

      • getPhotoshopThumbnail

        public JpegImage getPhotoshopThumbnail()

        Gets Photoshop preview thumbnail (if it's present in initial EPS data)

        Returns:
        Photoshop preview thumbnail
      • hasRasterPreview

        public abstract boolean hasRasterPreview()

        Gets a value indicating whether this instance has format-specific raster preview

        Value: true if this instance has format-specific raster preview; otherwise, false.
        Returns:
        a value indicating whether this instance has format-specific raster preview
      • getBitsPerPixel

        public int getBitsPerPixel()

        Gets the image bits per pixel count.

        Value: The image bits per pixel count.
        Specified by:
        getBitsPerPixel in class Image
        Returns:
        the image bits per pixel count.
      • isCached

        public boolean isCached()

        Gets a value indicating whether object's data is cached currently and no data reading is required.

        Value: true if object's data is cached; otherwise, false.
        Specified by:
        isCached in class DataStreamSupporter
        Returns:
        a value indicating whether object's data is cached currently and no data reading is required.
      • getPreviewToExport

        public final int getPreviewToExport()

        Preview to use for export

      • setPreviewToExport

        public final void setPreviewToExport(int value)

        Preview to use for export

      • getPostScriptVersion

        public String getPostScriptVersion()

        Gets the PostScript version field

        Returns:
        The PostScript version field
      • getTitle

        public String getTitle()

        Gets the Title field

        Returns:
        The Title field
      • getCreator

        public String getCreator()

        Gets the Creator field

        Returns:
        The Creator field
      • getCreationDateString

        public String getCreationDateString()

        Gets he CreationDate field string value

        Returns:
        The CreationDate field string value
      • getCreationDate

        public Date getCreationDate()

        Gets the CreationDate field

        Returns:
        The CreationDate field
      • getBoundingBoxString

        public String getBoundingBoxString()

        Gets the BoundingBox string value

        Returns:
        The BoundingBox string value
      • getBoundingBoxBottomLeft

        public Point getBoundingBoxBottomLeft()

        Gets the bounding box bottom left position

        Returns:
        The bounding box bottom left position
      • getBoundingBoxTopRight

        public Point getBoundingBoxTopRight()

        Gets the bounding box top right position

        Returns:
        The bounding box top right position
      • getPagesCount

        public Integer getPagesCount()

        Gets the pages count

        Returns:
        The pages count
      • getPageNumber

        public Integer getPageNumber()

        Gets the page number

        Returns:
        The page number
      • resize

        public void resize(int newWidth,
                           int newHeight,
                           int resizeType)

        Resizes the image.

        Specified by:
        resize in class Image
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        resizeType - The resize type.
        Code example:

        Resize EPS image and export it to PNG format.


        // Load EPS image
        try (Image 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());
        }
        

      • resize

        public void resize(int newWidth,
                           int newHeight,
                           ImageResizeSettings settings)

        Resizes the image.

        Specified by:
        resize in class Image
        Parameters:
        newWidth - The new width.
        newHeight - The new height.
        settings - The resize settings.
        Code example:

        Resize EPS image using advanced settings.


        // Load EPS image
        try (Image image = Image.load("AstrixObelix.eps"))
        {
            ImageResizeSettings resizeSettings = new ImageResizeSettings();
            // Set the interpolation mode
            resizeSettings.setMode(ResizeType.LanczosResample);
            // Set the type of the filter
            resizeSettings.setFilterType(ImageFilterType.SmallRectangular);
            // Sets the color compare method
            resizeSettings.setColorCompareMethod(ColorCompareMethod.Euclidian);
            // Set the color quantization method
            resizeSettings.setColorQuantizationMethod(ColorQuantizationMethod.Popularity);
        
            // Resize the image using advanced resize settings
            image.resize(400, 400, resizeSettings);
        
            // Export image to PNG format
            image.save("ExportResult.png", new PngOptions());
        }
        

      • rotateFlip

        public void rotateFlip(int rotateFlipType)

        Rotates, flips, or rotates and flips the image.

        Specified by:
        rotateFlip in class Image
        Parameters:
        rotateFlipType - Type of the rotate flip.
        Throws:
        com.aspose.ms.System.NotSupportedException - Rotate flip is not supported for EPS image
      • setPalette

        public void setPalette(IColorPalette palette,
                               boolean updateColors)

        Sets the image palette.

        Specified by:
        setPalette in class Image
        Parameters:
        palette - 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.
        Throws:
        com.aspose.ms.System.NotImplementedException - Not valid for vector images
      • saveData

        public void saveData(com.aspose.ms.System.IO.Stream stream)

        Saves the data.

        Parameters:
        stream - The stream to save data to.