java.lang.Object
org.sejda.sambox.pdmodel.graphics.image.JPEGFactory
Factory for creating a PDImageXObject containing a JPEG compressed image.
- Author:
- John Hewson
-
Method Summary
Modifier and TypeMethodDescriptionstatic PDImageXObjectcreateFromFile(File file) Creates a new JPEG Image XObject from an input stream containing JPEG data.static PDImageXObjectcreateFromImage(BufferedImage image) Creates a new JPEG Image XObject from a Buffered Image.static PDImageXObjectcreateFromImage(BufferedImage image, float quality) Creates a new JPEG Image XObject from a Buffered Image and a given quality.static PDImageXObjectcreateFromImage(BufferedImage image, float quality, int dpi) Creates a new JPEG Image XObject from a Buffered Image, a given quality and DPI.static PDImageXObjectcreateFromSeekableSource(org.sejda.io.SeekableSource source) static PDColorSpacegetColorSpaceFromAWT(BufferedImage awtImage) static BufferedImagereadJpegFile(File file)
-
Method Details
-
createFromFile
Creates a new JPEG Image XObject from an input stream containing JPEG data.The input stream data will be preserved and embedded in the PDF file without modification.
- Parameters:
file- a JPEG file- Returns:
- a new Image XObject
- Throws:
IOException- if the input stream cannot be read
-
createFromSeekableSource
public static PDImageXObject createFromSeekableSource(org.sejda.io.SeekableSource source) throws IOException - Throws:
IOException
-
readJpegFile
- Throws:
IOException
-
createFromImage
Creates a new JPEG Image XObject from a Buffered Image.- Parameters:
image- the buffered image to embed- Returns:
- a new Image XObject
- Throws:
IOException- if the JPEG data cannot be written
-
createFromImage
Creates a new JPEG Image XObject from a Buffered Image and a given quality. The image will be created at 72 DPI.- Parameters:
image- the buffered image to embedquality- the desired JPEG compression quality- Returns:
- a new Image XObject
- Throws:
IOException- if the JPEG data cannot be written
-
createFromImage
public static PDImageXObject createFromImage(BufferedImage image, float quality, int dpi) throws IOException Creates a new JPEG Image XObject from a Buffered Image, a given quality and DPI.- Parameters:
image- the buffered image to embedquality- the desired JPEG compression qualitydpi- the desired DPI (resolution) of the JPEG- Returns:
- a new Image XObject
- Throws:
IOException- if the JPEG data cannot be written
-
getColorSpaceFromAWT
-