Re: [Gimp-user] Gimp Java Batch not working



... the Java code :) :

File imageFile = new File(this.targetDir.getPath() + File.separator + UUID.randomUUID().toString() + ".png"); File testFile = new File(this.targetDir.getPath() + File.separator + "test.png");
        Tools.compressJpegFile(imageFile, inImage, 1.0f);
String argString = String.format("(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE \"%s\" \"%s\")))"
                + "(drawable (car (gimp-image-get-active-layer image))))"
                + "(plug-in-sobel RUN-NONINTERACTIVE image drawable 1 1 1)"
+ "(gimp-file-save RUN-NONINTERACTIVE image drawable \"%s\" \"%s\")" + "(gimp-image-delete image))", imageFile.getPath(), imageFile.getPath(), testFile.getPath(), testFile.getPath()); String script = String.format("\"C:\\Program Files\\GIMP 2\\bin\\gimp-2.8.exe\" -i -b '%s' -b '(gimp-quit 0)'", argString);
        ProcessBuilder builder = new ProcessBuilder(script);
        builder.directory(this.targetDir);
        builder.redirectErrorStream(true);
        if (!this.isCancelled()) {
            Process process = builder.start();
            InputStream is = process.getInputStream();
            InputStreamReader isr = new InputStreamReader(is);
            BufferedReader br = new BufferedReader(isr);
            String line;
            while ((line = br.readLine()) != null) {
                System.out.println(line);
            }
            System.out.println("Program terminated!");
            process.waitFor();
        }

Kind regards,
Andreas

Am 07.03.2014 10:52, schrieb Andreas Truszkowski:
Hi there,

I am new to Gimp and first I want to thank the Gimp community for such a great application.

But here is my problem. I try to process images from within a Java application. When I run the assembled batch command the gimp console writes that the execution was successfull.


But actually nothing happens. Here is my Java code:


The resulting command line is:

"C:\Program Files\GIMP 2\bin\gimp-2.8.exe" -i -b '(let* ((image (car (gimp-file-load RUN-NONINTERACTIVE "z:\test\26cf5abe-eaa1-4ddd-af04-3d9e59804ed2.png" "z:\test\26cf5abe-eaa1-4ddd-af04-3d9e59804ed2.png")))(drawable (car (gimp-image-get-active-layer image))))(plug-in-sobel RUN-NONINTERACTIVE image drawable 1 1 1)(gimp-file-save RUN-NONINTERACTIVE image drawable "z:\test\test.png" "z:\test\test.png")(gimp-image-delete image))' -b '(gimp-quit 0)'

Executing this directly from command line does not fix the problem. Anyone a clue what I make wrong? Thank you in advance...

Kind regards,
Andreas
_______________________________________________
gimp-user-list mailing list
List address:    gimp-user-list gnome org
List membership: https://mail.gnome.org/mailman/listinfo/gimp-user-list
List archives:   https://mail.gnome.org/archives/gimp-user-list



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]