I want to use cmd Commands in java program,
Want to crope all images in folder, I downlaoded ImageMagick, and using cmd commands Its working 1 image,
cd C:\Users\Robert\Java-workspace\Crop_test\Crop_test1
cd convert -crop 312x312+0-10 image1.jpg new_image1.jpg
But, I want to use this in Java so, I can crop all images in folder by program, Here is my java program:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import org.omg.CORBA.portable.OutputStream;
public class test1 {
public static void main(String argv[]) throws IOException, InterruptedException {
ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "C:\\Users\\Robert\\Java-workspace\\Crop_test\\Crop_test1\\", "convert -crop 312x312+0-10 image1.jpg new_image1.jpg");
Process p = pb.start();
p.waitFor();
}
}