Class Image

    • Method Detail

      • create

        public static Image create​(Document targetDocument,
                                   Stream stream)
                            throws java.io.IOException,
                                   UnknownFormatException,
                                   CorruptException

        Create an image object from image data.

        Supported formats are:
        • BMP
        • DIB
        • JPEG
        • JPEG2000
        • JBIG2
        • PNG
        • GIF
        The returned image object is not yet painted on any page, but it is associated with the given target document.
        Parameters:
        targetDocument - the output document with which the returned object is associated
        stream - the image data stream
        Returns:
        the newly created image object
        Throws:
        java.io.IOException - Error reading from the image or writing to the document
        UnknownFormatException - The image data has an unknown format
        CorruptException - The image data is corrupt
        java.lang.IllegalArgumentException - if the targetDocument argument has already been closed
        java.lang.IllegalArgumentException - if the targetDocument argument is read-only
        java.lang.IllegalArgumentException - if the stream argument is null
        java.lang.IllegalArgumentException - if targetDocument is null
        java.lang.IllegalArgumentException - if stream is null
      • getSize

        public Size getSize()

        The size of the image in samples. (Getter)

        Throws:
        java.lang.IllegalStateException - if the image has already been closed
      • getBitsPerComponent

        public int getBitsPerComponent()

        the number of bits per component. (Getter)

        The number of bits used to represent each color component. Only a single value may be specified; the number of bits is the same for all color components. Valid values are 1, 2, 4, and 8.
        Throws:
        java.lang.IllegalStateException - if the image has already been closed
      • getColorSpace

        public ColorSpace getColorSpace()

        the color space in which image samples are specified. (Getter)

        Throws:
        java.lang.IllegalStateException - if the image has already been closed