public static void setCompressionType ( ImageWriteParam param , BufferedImage image ) { // avoid error: first compression type is RLE, not optimal and incorrect for color images // TODO expose this choice to the user? if ( image . getType ( ) == BufferedImage . TYPE_BYTE_BINARY && image . getColorModel ( ) . getPixelSize ( ) == 1 ) { param . setCompressionType ( "CCITT T.6" ) ; } else { param . setCompressionType ( "LZW" ) ; } }
Sets the ImageIO parameter compression type based on the given image .