com.aspose.pdf

Interfaces

Classes

Enums

Exceptions

com.aspose.pdf

Class XImage



  • public final class XImage
    extends Object

    Class representing image X-Object.

    • Method Detail

      • containsTransparency

        public boolean containsTransparency()

        If the image contains transparancy than return true; otherwise, false.

        Returns:
        boolean value
      • getGrayscaled

        public BufferedImage getGrayscaled()

        Gets grayscaled version of image.

        Returns:
        BufferedImage
      • delete

        public void delete()

        Deletes image from the parent collection.

      • replace

        public void replace(InputStream image)

        Replaces image onto stream specified in image.

        *
        Parameters:
        image - Stream with image data.
      • getEngineImg

        public com.aspose.pdf.engine.data.IPdfDataStream getEngineImg()

        IPdfImage object which decribes image. Internal only

        Returns:
        IPdfDataStream
      • getWidth

        public int getWidth()

        Gets width of the image.

        Returns:
        int value
      • getHeight

        public int getHeight()

        Gets height of the image.

        Returns:
        int value
      • getName

        public String getName()

        Gets image name.

        Returns:
        String
      • setName

        public void setName(String value)

        Sets image name.

        Parameters:
        value - String value
      • save

        public void save(OutputStream stream)

        Saves image data into stream as JPEG image.

        Parameters:
        stream - Stream where image data will be saved.
      • save

        public void save(OutputStream stream,
                         float xDpi,
                         float yDpi)

        Saves image into stream with requested format.

        Parameters:
        stream - OutputStream where image will be saved
        xDpi - Image horizontal resolution
        yDpi - Image vertical resolution
      • save

        public void save(OutputStream stream,
                         ImageType format)

        Saves image into stream with requested format.

        Parameters:
        stream - Stream where image will be saved
        format - Format which will be used for image enconding.
        See Also:
        ImageType
      • getImage

        public com.aspose.ms.System.Drawing.Bitmap getImage()
        For internal use only
        Returns:
        Image
      • saveInternal

        public void saveInternal(com.aspose.ms.System.IO.Stream stream,
                                 int resolution)

        Saves image data into stream as JPEG image with specified resolution.

        Parameters:
        stream - Stream where image data will be saved.
        resolution - Image resolution
      • save

        public void save(OutputStream stream,
                         int resolution)

        Saves image into stream with requested format with specified resolution.

        Parameters:
        stream - Stream where image will be saved
        resolution - Image resolution
      • saveInternal

        public void saveInternal(com.aspose.ms.System.IO.Stream stream,
                                 ImageType format,
                                 int resolution)
      • save

        public void save(OutputStream stream,
                         ImageType format,
                         int resolution)

        Saves image into stream with requested format.

        Parameters:
        stream - Stream where image will be saved
        format - Format which will be used for image enconding.
        resolution - Image resolution
        See Also:
        ImageType
      • isImage

        public static boolean isImage(com.aspose.pdf.engine.data.IPdfPrimitive primitive)

        Returns true if the primitive is an image.

        Parameters:
        primitive - IPdfPrimitive
        Returns:
        boolean
      • getColorType

        public int getColorType()

        Returns color type of image.

        Returns:
        The color type value.
      • isTheSameObject

        public boolean isTheSameObject(XImage image)

        Returns true if both images references to the same object.

        Parameters:
        image - Image to be compared with "this" image.
        Returns:
        Boolean value which is true if images references to the same object.
      • getNameInCollection

        public String getNameInCollection()

        Returns name of the image in its collection.

        Returns:
        Image key (name).
      • getRawParameters

        public XImage.RawParameters getRawParameters()
        Gets raw image parameters
        Returns:
        RawParameters instance
      • toString

        public String toString()
        Returns a string representation XImage object properties.
        Overrides:
        toString in class Object
        Returns:
        String instance
      • getRawBytes

        public byte[] getRawBytes()
        Returns raw bytes for the image without decoding.
        Returns:
        byte array
      • toStream

        public InputStream toStream()

        Returns the original image stream.

        Returns:
        The original image stream.