properties.setProperty(formatKey + ANTIALIAS_TEXT, true);
// copy parameters from specific format
ImageWriter writer = getPreferredImageWriter(format);
if (writer != null) {
ImageWriteParam param = writer.getDefaultWriteParam();
// compression
if (param.canWriteCompressed()) {
param.setCompressionMode(ImageWriteParam.MODE_EXPLICIT);
properties.setProperty(formatKey + COMPRESS, true);
String[] compressionTypes = param.getCompressionTypes();
String compressionType = param.getCompressionType();
properties.setProperty(formatKey + COMPRESS_MODE, compressionType != null ? compressionType : compressionTypes[0]);
properties.setProperty(formatKey + COMPRESS_DESCRIPTION,
"Custom");
float compressionQuality = 0.0f;
try {
compressionQuality = param.getCompressionQuality();
} catch (IllegalStateException e) {
// ignored
}
properties.setProperty(formatKey + COMPRESS_QUALITY, compressionQuality);
} else {
properties.setProperty(formatKey + COMPRESS, false);
properties.setProperty(formatKey + COMPRESS_MODE, "");
properties.setProperty(formatKey + COMPRESS_DESCRIPTION,
"Custom");
properties.setProperty(formatKey + COMPRESS_QUALITY, 0.0f);
}
// progressive
if (param.canWriteProgressive()) {
properties
.setProperty(
formatKey + PROGRESSIVE,
param.getProgressiveMode() != ImageWriteParam.MODE_DISABLED);
} else {
properties.setProperty(formatKey + PROGRESSIVE, false);
}
} else {
System.err.println(ImageGraphics2D.class