/** * Creates a new JPEG Image XObject from a BufferedImage, a given quality and dpi metadata. * <p> * Do not read a JPEG image from a stream/file and call this method; you'll get more speed and * quality by calling {@link #createFromStream(org.apache.pdfbox.pdmodel.PDDocument, * java.io.InputStream) createFromStream()} instead. * * @param document the document where the image will be created * @param image the BufferedImage to embed * @param quality The desired JPEG compression quality; between 0 (best * compression) and 1 (best image quality). See * {@link ImageWriteParam#setCompressionQuality(float)} for more details. * @param dpi the desired dpi (resolution) value of the JPEG to be stored in metadata. This * value has no influence on image content or size. * @return a new Image XObject * @throws IOException if the JPEG data cannot be written */ public static PDImageXObject createFromImage(PDDocument document, BufferedImage image, float quality, int dpi) throws IOException { return createJPEG(document, image, quality, dpi); }
/** * Creates a new JPEG Image XObject from a BufferedImage, a given quality and dpi metadata. * <p> * Do not read a JPEG image from a stream/file and call this method; you'll get more speed and * quality by calling {@link #createFromStream(org.apache.pdfbox.pdmodel.PDDocument, * java.io.InputStream) createFromStream()} instead. * * @param document the document where the image will be created * @param image the BufferedImage to embed * @param quality the desired JPEG compression quality * @param dpi the desired dpi (resolution) value of the JPEG to be stored in metadata. This * value has no influence on image content or size. * @return a new Image XObject * @throws IOException if the JPEG data cannot be written */ public static PDImageXObject createFromImage(PDDocument document, BufferedImage image, float quality, int dpi) throws IOException { return createJPEG(document, image, quality, dpi); }
/** * Creates a new JPEG Image XObject from a BufferedImage, a given quality and dpi metadata. * <p> * Do not read a JPEG image from a stream/file and call this method; you'll get more speed and * quality by calling {@link #createFromStream(org.apache.pdfbox.pdmodel.PDDocument, * java.io.InputStream) createFromStream()} instead. * * @param document the document where the image will be created * @param image the BufferedImage to embed * @param quality The desired JPEG compression quality; between 0 (best * compression) and 1 (best image quality). See * {@link ImageWriteParam#setCompressionQuality(float)} for more details. * @param dpi the desired dpi (resolution) value of the JPEG to be stored in metadata. This * value has no influence on image content or size. * @return a new Image XObject * @throws IOException if the JPEG data cannot be written */ public static PDImageXObject createFromImage(PDDocument document, BufferedImage image, float quality, int dpi) throws IOException { return createJPEG(document, image, quality, dpi); }