如果它有帮助,这是我用来修改TiffImageWriteParam来设置压缩的代码:
try {
jWriteParam.setCompressionMode(_compression != TiffCompression.NO_COMPRESSION
? ImageWriteParam.MODE_EXPLICIT : ImageWriteParam.MODE_DISABLED);
if (_compression != TiffCompression.NO_COMPRESSION) {
// this code corrects the compression if, say, the client code asked for
// CCITT but the actual image pixel format was CMYK or some other non-1 bit
// image type.
TiffCompression mode = recastToValidCompression(_compression, pf);
jWriteParam.setCompressionType(getCompressionType(mode));
TIFFCompressor compressor = getTiffCompressor(mode, jWriteParam, shouldUsePredictor(pf));
jWriteParam.setTIFFCompressor(compressor);
if (_compression == TiffCompression.JPEG_COMPRESSION) {
// Java supports setting to 1.0 (ie 100), but it will not actually d