registerEncoder(new Convert());
registerEncoder(new WebpEncoder());
registerEncoder(new WebpDecoder());
+ registerEncoder(new JxlDecoder());
// 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 JxlDecoder extends AbstractConverter {
+
+ @Override
+ public String getCommand(final File inputFile, final File targetFile,
+ final EncodingOptions options, String targetFormat) {
+ if ("jpg".equals(targetFormat) || "jpeg".equals(targetFormat)) {
+ return "tmp=$(mktemp /tmp/meviz_jxl_XXXXXX.png) && " +
+ "djxl \"" + inputFile.getAbsolutePath() + "\" \"$tmp\" && " +
+ "convert \"$tmp\" \"" + targetFile.getAbsolutePath() + "\" && " +
+ "rm -f \"$tmp\"";
+ }
+ return "djxl \"" + inputFile.getAbsolutePath() + "\" \"" +
+ targetFile.getAbsolutePath() + "\"";
+ }
+
+ @Override
+ public List<String> getTargetFileExtensions() {
+ return toList("png", "jpg", "jpeg");
+ }
+
+ @Override
+ public List<String> getSourceFileExtensions() {
+ return toList("jxl");
+ }
+
+ @Override
+ public boolean isTerminalMandatory() {
+ return false;
+ }
+}