src/main/java/org/openjfx/core/ImageUtil.java
private static void convert(File inputFile, File outputDirectory, String format, HashMap<String, ArrayList<String>> extraCommandLineParams) throws Exception {

        String fileName = inputFile.getName().split("\\.")[0];

        // generated file path / name
        StringBuilder outputFileStreamBuilder = new StringBuilder(outputDirectory.getAbsolutePath());
        outputFileStreamBuilder.append(File.separatorChar);
        outputFileStreamBuilder.append(fileName);
        outputFileStreamBuilder.append("-converted");
        outputFileStreamBuilder.append(".");
        outputFileStreamBuilder.append(format);

        String outputFile = outputFileStreamBuilder.toString();

        boolean isWindows = System.getProperty("os.name")
                .toLowerCase().startsWith("windows");

        String binName = isWindows ? "magick.exe" : "magick";

        ArrayList<String> commandLine = new ArrayList<>(Arrays.asList(
                binName,
                "convert",
                inputFile.getAbsolutePath()
        ));

        extraCommandLineParams.entrySet().forEach(
                (entry) -> {
                    commandLine.addAll(entry.getValue());
                }
        );

        commandLine.add(outputFile);

        System.out.println("[INFO] Command line to execute");
        System.out.println(commandLine);

        try {

            Process process = Runtime.getRuntime()
                    .exec(
                            Arrays.copyOf(
                                    commandLine.toArray(),
                                    commandLine.size(),
                                    String[].class
                            )
                    );
            System.out.println("ImageMagick Exit status = " + process.waitFor());
        } catch (
                InterruptedException e) {
            e.printStackTrace();
        }

    }
/**
     * Call ImageMagick to convert the image file
     * @param inputFile - The image file to convert
     * @param outputDirectory - The directory to save converted images
     * @param format - The image format (e.g. JPG, PNG)
     * @param extraCommandLineParams - For filters, etc. e.g. -threshold 15% -type bilevel
     *
     * @throws Exception
     */
Call ImageMagick to convert the image file
@param inputFile - The image file to convert
@param outputDirectory - The directory to save converted images
@param format - The image format
@param extraCommandLineParams - For filters, etc.

@throws Exception
Call ImageMagick to convert the image file @param inputFile - The image file to convert @param outputDirectory - The directory to save converted images @param format - The image format @param extraCommandLineParams - For filters etc . @throws Exception
private static void convert(File inputFile, File outputDirectory, String format, HashMap<String, ArrayList<String>> extraCommandLineParams) throws Exception {
        String fileName = inputFile.getName().split("\\.")[0];
        StringBuilder outputFileStreamBuilder = new StringBuilder(outputDirectory.getAbsolutePath());
        outputFileStreamBuilder.append(File.separatorChar);
        outputFileStreamBuilder.append(fileName);
        outputFileStreamBuilder.append("-converted");
        outputFileStreamBuilder.append(".");
        outputFileStreamBuilder.append(format);
        String outputFile = outputFileStreamBuilder.toString();
        boolean isWindows = System.getProperty("os.name")
                .toLowerCase().startsWith("windows");
        String binName = isWindows ? "magick.exe" : "magick";
        ArrayList<String> commandLine = new ArrayList<>(Arrays.asList(
                binName,
                "convert",
                inputFile.getAbsolutePath()
        ));
        extraCommandLineParams.entrySet().forEach(
                (entry) -> {
                    commandLine.addAll(entry.getValue());
                }
        );
        commandLine.add(outputFile);
        System.out.println("[INFO] Command line to execute");
        System.out.println(commandLine);
        try {
            Process process = Runtime.getRuntime()
                    .exec(
                            Arrays.copyOf(
                                    commandLine.toArray(),
                                    commandLine.size(),
                                    String[].class
                            )
                    );
            System.out.println("ImageMagick Exit status = " + process.waitFor());
        } catch (
                InterruptedException e) {
            e.printStackTrace();
        }
    }
private static void convert ( File inputFile , File outputDirectory , String format , HashMap < String , ArrayList < String > > extraCommandLineParams ) throws Exception { String fileName = inputFile . getName ( ) . split ( "\\." ) [ 0 ] ; StringBuilder outputFileStreamBuilder = new StringBuilder ( outputDirectory . getAbsolutePath ( ) ) ; outputFileStreamBuilder . append ( File . separatorChar ) ; outputFileStreamBuilder . append ( fileName ) ; outputFileStreamBuilder . append ( "-converted" ) ; outputFileStreamBuilder . append ( "." ) ; outputFileStreamBuilder . append ( format ) ; String outputFile = outputFileStreamBuilder . toString ( ) ; boolean isWindows = System . getProperty ( "os.name" ) . toLowerCase ( ) . startsWith ( "windows" ) ; String binName = isWindows ? "magick.exe" : "magick" ; ArrayList < String > commandLine = new ArrayList < > ( Arrays . asList ( binName , "convert" , inputFile . getAbsolutePath ( ) ) ) ; extraCommandLineParams . entrySet ( ) . forEach ( ( entry ) -> { commandLine . addAll ( entry . getValue ( ) ) ; } ) ; commandLine . add ( outputFile ) ; System . out . println ( "[INFO] Command line to execute" ) ; System . out . println ( commandLine ) ; try { Process process = Runtime . getRuntime ( ) . exec ( Arrays . copyOf ( commandLine . toArray ( ) , commandLine . size ( ) , String [ ] . class ) ) ; System . out . println ( "ImageMagick Exit status = " + process . waitFor ( ) ) ; } catch ( InterruptedException e ) { e . printStackTrace ( ) ; } }
Call ImageMagick to convert the image file
 @param inputFile - The image file to convert
 @param outputDirectory - The directory to save converted images
 @param format - The image format (e.g.
Call ImageMagick to convert the image file @param inputFile - The image file to convert @param outputDirectory - The directory to save converted images @param format - The image format ( e . g .
// generated file path / name