Class Image
- java.lang.Object
-
- com.pdf_tools.fourheights.pdftoolbox.internal.NativeBase
-
- com.pdf_tools.fourheights.pdftoolbox.internal.NativeObject
-
- com.pdf_tools.fourheights.pdftoolbox.pdf.content.Image
-
public class Image extends NativeObject
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Image
create(Document targetDocument, Stream stream)
Create an image object from image data.int
getBitsPerComponent()
the number of bits per component.ColorSpace
getColorSpace()
the color space in which image samples are specified.Size
getSize()
The size of the image in samples.-
Methods inherited from class com.pdf_tools.fourheights.pdftoolbox.internal.NativeObject
equals, hashCode
-
-
-
-
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
- Parameters:
targetDocument
- the output document with which the returned object is associatedstream
- the image data stream- Returns:
- the newly created image object
- Throws:
java.io.IOException
- Error reading from the image or writing to the documentUnknownFormatException
- The image data has an unknown formatCorruptException
- The image data is corruptjava.lang.IllegalArgumentException
- if thetargetDocument
argument has already been closedjava.lang.IllegalArgumentException
- if thetargetDocument
argument is read-onlyjava.lang.IllegalArgumentException
- if thestream
argument isnull
java.lang.IllegalArgumentException
- iftargetDocument
isnull
java.lang.IllegalArgumentException
- ifstream
isnull
-
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
-
-