Class BitmapCompressor
java.lang.Object
com.itextpdf.pdfoptimizer.handlers.imagequality.processors.BitmapCompressor
- All Implemented Interfaces:
-
IImageProcessor
Class is used to optimize bitmap images.
-
Constructor Summary
ConstructorDescriptionBitmapCompressor
(double scaling, double compression) Creates a new instance of processor.BitmapCompressor
(double scaling, IScalingAlgorithm algorithm, double compression) Creates a new instance of processor. -
Method Summary
Modifier and TypeMethodDescriptioncom.itextpdf.kernel.pdf.xobject.PdfImageXObject
processImage
(com.itextpdf.kernel.pdf.xobject.PdfImageXObject objectToProcess, OptimizationSession session) Optimizes a bitmap image: scales it, changes color scheme from CMYK to RGB if necessary and then compressed it as JPEG.
-
Constructor Details
-
BitmapCompressor
public BitmapCompressor(double scaling, double compression) Creates a new instance of processor. By defaultAverageCalculationAlgorithm
is used for scaling.- Parameters:
-
scaling
- is a scaling coefficient, must be in range [0., 1.] -
compression
- is a compression coefficient, must be in range [0., 1.]
-
BitmapCompressor
Creates a new instance of processor.- Parameters:
-
scaling
- is a scaling coefficient, must be in range [0., 1.] -
algorithm
- is a scaling algorithm -
compression
- is a compression coefficient, must be in range [0., 1.]
-
-
Method Details
-
processImage
public com.itextpdf.kernel.pdf.xobject.PdfImageXObject processImage(com.itextpdf.kernel.pdf.xobject.PdfImageXObject objectToProcess, OptimizationSession session) throws IOException Optimizes a bitmap image: scales it, changes color scheme from CMYK to RGB if necessary and then compressed it as JPEG.- Specified by:
-
processImage
in interfaceIImageProcessor
- Parameters:
-
objectToProcess
- is aPdfImageXObject
representing the image -
session
- is an auxiliary object used to support share data between stages of optimization process - Returns:
- processed image if processing can be performed and the same instance otherwise
- Throws:
-
IOException
- if image cannot be optimized as JPEG
-