Add multiple quality levels for JPG encoding - adjust default to 0.85

This commit is contained in:
Mike Primm 2011-08-16 12:26:28 +08:00 committed by mikeprimm
parent 4616f6a5be
commit 477a7d13de
8 changed files with 69 additions and 41 deletions

View file

@ -91,11 +91,17 @@ public class HDMap extends MapType {
}
String fmt = configuration.getString("image-format", "png");
/* Only allow png or jpg */
if(fmt.equals(IMGFORMAT_PNG))
for(ImageFormat f : ImageFormat.values()) {
if(fmt.equals(f.getID())) {
imgformat = f;
break;
}
}
if(imgformat == null) {
Log.severe("HDMap '"+name+"' set invalid image-format: " + fmt);
imgformat = ImageFormat.FORMAT_PNG;
else
imgformat = ImageFormat.FORMAT_JPG;
}
}
}
public HDShader getShader() { return shader; }
public HDPerspective getPerspective() { return perspective; }

View file

@ -1041,7 +1041,7 @@ public class IsoHDPerspective implements HDPerspective {
if(!f.getParentFile().exists())
f.getParentFile().mkdirs();
try {
FileLockManager.imageIOWrite(im[i].buf_img, fmt.getFileExt(), f);
FileLockManager.imageIOWrite(im[i].buf_img, fmt, f);
} catch (IOException e) {
Debug.error("Failed to save image: " + f.getPath(), e);
} catch (java.lang.NullPointerException e) {
@ -1074,7 +1074,7 @@ public class IsoHDPerspective implements HDPerspective {
if(!f.getParentFile().exists())
f.getParentFile().mkdirs();
try {
FileLockManager.imageIOWrite(dayim[i].buf_img, fmt.getFileExt(), f);
FileLockManager.imageIOWrite(dayim[i].buf_img, fmt, f);
} catch (IOException e) {
Debug.error("Failed to save image: " + f.getPath(), e);
} catch (java.lang.NullPointerException e) {