Java Code Examples for javax.imageio.ImageWriteParam#getCompressionQuality()

The following examples show how to use javax.imageio.ImageWriteParam#getCompressionQuality() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TIFFDeflater.java    From Bytecoder with Apache License 2.0 6 votes vote down vote up
public TIFFDeflater(String compressionType,
                    int compressionTagValue,
                    ImageWriteParam param,
                    int predictorValue) {
    super(compressionType, compressionTagValue, true);

    this.predictor = predictorValue;

    // Set the deflate level.
    int deflateLevel;
    if(param != null &&
       param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) {
        float quality = param.getCompressionQuality();
        deflateLevel = (int)(1 + 8*quality);
    } else {
        deflateLevel = Deflater.DEFAULT_COMPRESSION;
    }

    this.deflater = new Deflater(deflateLevel);
}
 
Example 2
Source File: TIFFDeflater.java    From openjdk-jdk9 with GNU General Public License v2.0 6 votes vote down vote up
public TIFFDeflater(String compressionType,
                    int compressionTagValue,
                    ImageWriteParam param,
                    int predictorValue) {
    super(compressionType, compressionTagValue, true);

    this.predictor = predictorValue;

    // Set the deflate level.
    int deflateLevel;
    if(param != null &&
       param.getCompressionMode() == ImageWriteParam.MODE_EXPLICIT) {
        float quality = param.getCompressionQuality();
        deflateLevel = (int)(1 + 8*quality);
    } else {
        deflateLevel = Deflater.DEFAULT_COMPRESSION;
    }

    this.deflater = new Deflater(deflateLevel);
}