added option webp-l to use lossless webp #3191

This commit is contained in:
Ben Lönnqvist 2021-01-08 23:45:30 +02:00
parent 34348a6d16
commit 3f821a902d
No known key found for this signature in database
GPG Key ID: 0D5AC095F3916B18
14 changed files with 15 additions and 14 deletions

View File

@ -73,7 +73,8 @@ public abstract class MapType {
FORMAT_WEBP("webp", 85, ImageEncoding.WEBP), FORMAT_WEBP("webp", 85, ImageEncoding.WEBP),
FORMAT_WEBP90("webp-q90", 90, ImageEncoding.WEBP), FORMAT_WEBP90("webp-q90", 90, ImageEncoding.WEBP),
FORMAT_WEBP95("webp-q95", 95, ImageEncoding.WEBP), FORMAT_WEBP95("webp-q95", 95, ImageEncoding.WEBP),
FORMAT_WEBP100("webp-q100", 100, ImageEncoding.WEBP); FORMAT_WEBP100("webp-q100", 100, ImageEncoding.WEBP),
FORMAT_WEBPL("webp-l", 85, ImageEncoding.WEBP);
String id; String id;
float qual; float qual;
ImageEncoding enc; ImageEncoding enc;

View File

@ -59,7 +59,7 @@ public class ImageIOManager {
fos.close(); fos.close();
// Run encoder to new new temp file // Run encoder to new new temp file
File tmpfile2 = File.createTempFile("pngToWebp", "webp"); File tmpfile2 = File.createTempFile("pngToWebp", "webp");
String args[] = { core.getCWEBPPath(), "-q", Integer.toString((int)fmt.getQuality()), tmpfile.getAbsolutePath(), "-o", tmpfile2.getAbsolutePath() }; String args[] = { core.getCWEBPPath(), fmt.getID().endsWith("-l")?"-lossless":"", "-q", Integer.toString((int)fmt.getQuality()), tmpfile.getAbsolutePath(), "-o", tmpfile2.getAbsolutePath() };
Process pr = Runtime.getRuntime().exec(args); Process pr = Runtime.getRuntime().exec(args);
try { try {
pr.waitFor(); pr.waitFor();

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -254,7 +254,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings

View File

@ -255,7 +255,7 @@ block-alias:
# "minecraft:quartz_ore": "stone" # "minecraft:quartz_ore": "stone"
# "diamond_ore": "coal_ore" # "diamond_ore": "coal_ore"
# Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100), # Default image format for HDMaps (png, jpg, jpg-q75, jpg-q80, jpg-q85, jpg-q90, jpg-q95, jpg-q100, webp, webp-q75, webp-q80, webp-q85, webp-q90, webp-q95, webp-q100, wepb-l),
# Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download) # Note: any webp format requires the presence of the 'webp command line tools' (cwebp, dwebp) (https://developers.google.com/speed/webp/download)
# #
# Has no effect on maps with explicit format settings # Has no effect on maps with explicit format settings