java.lang.Object
org.sejda.sambox.pdmodel.graphics.image.CCITTFactory
Factory for creating a PDImageXObject containing a CCITT Fax compressed TIFF image.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic PDImageXObjectcreateFromFile(File file) Creates a new CCITT Fax compressed Image XObject from the first page of a TIFF file.static PDImageXObjectcreateFromFile(File file, int number) Creates a new CCITT Fax compressed Image XObject from the first page of a TIFF file.static PDImageXObjectcreateFromImage(BufferedImage image) Creates a new CCITT group 4 (T6) compressed image XObject from a b/w BufferedImage.private static PDImageXObjectcreateFromRandomAccessImpl(org.sejda.io.SeekableSource source, int number) Creates a new CCITT Fax compressed Image XObject from a TIFF file.static PDImageXObjectcreateFromSeekableSource(org.sejda.io.SeekableSource source) static PDImageXObjectcreateFromSeekableSource(org.sejda.io.SeekableSource source, int number) private static org.sejda.io.SeekableSourceextractFromTiff(org.sejda.io.SeekableSource source, COSDictionary params, int number) private static PDImageXObjectprepareImageXObject(byte[] byteArray, int width, int height, PDColorSpace initColorSpace) private static intreadlong(char endianess, org.sejda.io.SeekableSource source) private static intreadshort(char endianess, org.sejda.io.SeekableSource source)
-
Constructor Details
-
CCITTFactory
private CCITTFactory()
-
-
Method Details
-
createFromImage
Creates a new CCITT group 4 (T6) compressed image XObject from a b/w BufferedImage. This compression technique usually results in smaller images than those produced byLosslessFactory#createFromImage(PDDocument, BufferedImage).- Parameters:
image- the image.- Returns:
- a new image XObject.
- Throws:
IOException- if there is an error creating the image.IllegalArgumentException- if the BufferedImage is not a b/w image.
-
prepareImageXObject
private static PDImageXObject prepareImageXObject(byte[] byteArray, int width, int height, PDColorSpace initColorSpace) throws IOException - Throws:
IOException
-
createFromFile
Creates a new CCITT Fax compressed Image XObject from the first page of a TIFF file.- Parameters:
file- the TIFF file which contains a suitable CCITT compressed image- Returns:
- a new Image XObject
- Throws:
IOException- if there is an error reading the TIFF data.
-
createFromFile
Creates a new CCITT Fax compressed Image XObject from the first page of a TIFF file.- Parameters:
file- the TIFF file which contains a suitable CCITT compressed imagenumber- TIFF image number, starting from 0- Returns:
- a new Image XObject
- Throws:
IOException- if there is an error reading the TIFF data.
-
createFromSeekableSource
public static PDImageXObject createFromSeekableSource(org.sejda.io.SeekableSource source) throws IOException - Throws:
IOException
-
createFromSeekableSource
public static PDImageXObject createFromSeekableSource(org.sejda.io.SeekableSource source, int number) throws IOException - Throws:
IOException
-
createFromRandomAccessImpl
private static PDImageXObject createFromRandomAccessImpl(org.sejda.io.SeekableSource source, int number) throws IOException Creates a new CCITT Fax compressed Image XObject from a TIFF file.- Parameters:
source- the random access TIFF file which contains a suitable CCITT compressed imagenumber- TIFF image number, starting from 0- Returns:
- a new Image XObject, or null if no such page
- Throws:
IOException- if there is an error reading the TIFF data.
-
extractFromTiff
private static org.sejda.io.SeekableSource extractFromTiff(org.sejda.io.SeekableSource source, COSDictionary params, int number) throws IOException - Throws:
IOException
-
readshort
- Throws:
IOException
-
readlong
- Throws:
IOException
-