// image conversion
registerEncoder(new Convert());
- registerEncoder(new Cwebp());
+ registerEncoder(new WebpEncoder());
+ registerEncoder(new WebpDecoder());
// image to text (OCR)
registerEncoder(new Ocr());
+++ /dev/null
-/*
- * Meviz - Various tools collection to work with multimedia. Author: Svjatoslav Agejenko.
- * This project is released under Creative Commons Zero (CC0) license.
- */
-
-package eu.svjatoslav.meviz.encoder.converters;
-
-import eu.svjatoslav.meviz.encoder.EncodingOptions;
-
-import java.io.File;
-import java.util.List;
-
-public class Cwebp extends AbstractConverter {
-
- @Override
- public String getCommand(final File inputFile, final File targetFile,
- final EncodingOptions options, String targetFormat) {
-
- String quality;
-
- switch (options.getVideoBitrate()) {
- case LOW:
- quality = " -q 10 ";
- break;
- case MEDIUM:
- quality = " -q 50 ";
- break;
- case HIGH:
- quality = " -q 80 ";
- break;
- case COPY:
- case LOSSLESS:
- default:
- quality = " -lossless ";
- }
-
- return "cwebp \"" + inputFile.getAbsolutePath() + "\"" + quality + " -o \""
- + targetFile.getAbsolutePath() + "\"";
- }
-
- @Override
- public List<String> getSourceFileExtensions() {
- return toList("tif", "tiff", "png", "jpg", "jpeg", "bmp", "gif");
- }
-
- @Override
- public List<String> getTargetFileExtensions() {
- return toList("webp");
- }
-
- @Override
- public boolean isTerminalMandatory() {
- return false;
- }
-
-}
--- /dev/null
+/*
+ * Meviz - Various tools collection to work with multimedia. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
+ */
+
+package eu.svjatoslav.meviz.encoder.converters;
+
+import eu.svjatoslav.meviz.encoder.EncodingOptions;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * webp decoder.
+ */
+
+public class WebpDecoder extends AbstractConverter {
+
+ @Override
+ public String getCommand(final File inputFile, final File targetFile,
+ final EncodingOptions options, String targetFormat) {
+
+ return "dwebp \"" + inputFile.getAbsolutePath() + "\" -o \"" +
+ targetFile.getAbsolutePath() + "\"";
+ }
+
+ @Override
+ public List<String> getTargetFileExtensions() {
+ return toList("png");
+ }
+
+ @Override
+ public List<String> getSourceFileExtensions() {
+ return toList("webp");
+ }
+
+ @Override
+ public boolean isTerminalMandatory() {
+ return false;
+ }
+
+}
--- /dev/null
+/*
+ * Meviz - Various tools collection to work with multimedia. Author: Svjatoslav Agejenko.
+ * This project is released under Creative Commons Zero (CC0) license.
+ */
+
+package eu.svjatoslav.meviz.encoder.converters;
+
+import eu.svjatoslav.meviz.encoder.EncodingOptions;
+
+import java.io.File;
+import java.util.List;
+
+/**
+ * webp encoder.
+ */
+public class WebpEncoder extends AbstractConverter {
+
+ @Override
+ public String getCommand(final File inputFile, final File targetFile,
+ final EncodingOptions options, String targetFormat) {
+
+ String quality;
+
+ switch (options.getVideoBitrate()) {
+ case LOW:
+ quality = " -q 10 ";
+ break;
+ case MEDIUM:
+ quality = " -q 50 ";
+ break;
+ case HIGH:
+ quality = " -q 80 ";
+ break;
+ case COPY:
+ case LOSSLESS:
+ default:
+ quality = " -lossless ";
+ }
+
+ return "cwebp \"" + inputFile.getAbsolutePath() + "\"" + quality + " -o \""
+ + targetFile.getAbsolutePath() + "\"";
+ }
+
+ @Override
+ public List<String> getSourceFileExtensions() {
+ return toList("tif", "tiff", "png", "jpg", "jpeg", "bmp", "gif");
+ }
+
+ @Override
+ public List<String> getTargetFileExtensions() {
+ return toList("webp");
+ }
+
+ @Override
+ public boolean isTerminalMandatory() {
+ return false;
+ }
+
+}