java.lang.Object
com.itextpdf.pdfoptimizer.handlers.imagequality.processors.BitmapCompressor
All Implemented Interfaces:
IImageProcessor

public class BitmapCompressor extends Object implements IImageProcessor
Class is used to optimize bitmap images.
  • Constructor Summary

    Constructors
    Constructor
    Description
    BitmapCompressor(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 Type
    Method
    Description
    com.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.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • BitmapCompressor

      public BitmapCompressor (double scaling, double compression)
      Creates a new instance of processor. By default AverageCalculationAlgorithm 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

      public BitmapCompressor (double scaling, IScalingAlgorithm algorithm, double compression)
      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 interface IImageProcessor
      Parameters:
      objectToProcess - is a PdfImageXObject 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