How to make thumbnail of any image in java : code, Examples ?
/* This code need to configure image magik tool for Image Processing */
/* This code is completable for all windows and Linux operating system */
public int thumbImageMaker(String inputImage, String outputImage, int width, int height) {
int returnCode = 0;
Process process;
try {
String[] command = { "convert", "-thumbnail", width+"x"+height, inputImage, outputImage };
process = Runtime.getRuntime().exec(command);
returnCode = process.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return returnCode;
}
/* This code is completable for all windows and Linux operating system */
public int thumbImageMaker(String inputImage, String outputImage, int width, int height) {
int returnCode = 0;
Process process;
try {
String[] command = { "convert", "-thumbnail", width+"x"+height, inputImage, outputImage };
process = Runtime.getRuntime().exec(command);
returnCode = process.waitFor();
} catch (IOException e) {
e.printStackTrace();
} catch (InterruptedException e) {
e.printStackTrace();
}
return returnCode;
}
Comments
Post a Comment