I need to convert all the tif, jpeg, gif to jpg format. For this am using
ProcessBuilder pb2 = new ProcessBuilder("convert.exe", "\"" +dest.toString()+ "\" ", "\" " + dest.getParent().toString().concat("/").concat(dest.getName().toString().substring(0, dest.getName().toString().lastIndexOf(".")).concat(".jpg"))+ "\" " );
System.out.println("convert " + "\"" + dest.toString() + "\" " + "\" " + dest.getParent().toString().concat("/").concat(dest.getName().toString().substring(0, dest.getName().toString().lastIndexOf(".")).concat(".jpg")) + "\" " );
pb2.redirectErrorStream(true);
try {
Process p2 = pb2.start();
System.out.println("jpg done for " + dest.getName());
new Thread(new InputConsumer(p2.getInputStream())).start();
try {
System.out.println("Exited with: " + p2.waitFor());
} catch (InterruptedException ex) {
Logger.getLogger(ImageFileCopy.class.getName()).log(Level.SEVERE, null, ex);
}
} catch (IOException ex) {
Logger.getLogger(ImageFileCopy.class.getName()).log(Level.SEVERE, null, ex);
}
It is saying error "Invalid parameter - and Exited with: 4"
I also tried giving "C:\Program Files\ImageMagick-6.8.6-Q16\convert.exe". If i use full path system not showing error but wating for long time.
Any idea plz suggest.