String[] imageMagickCommands = imageMagickCommandList.toArray(new String[imageMagickCommandList.size()]);
try {
System.out.println("ImageMagickProcessor.processImage: " + imageMagickCommandList);
Result result = ERXRuntimeUtilities.execute(imageMagickCommands, null, null, 0);
int exitValue = result.getExitValue();
if (exitValue != 0) {
log.warn("Warning: ImageMagick convert returned with a value of " + exitValue + ", error = " + result.getErrorAsString());
}
}
catch (Exception e) {
IOException ioex = new IOException("ImageMagick failed.");
ioex.initCause(e);
throw ioex;
}
if (watermarkFile != null) {
List<String> watermarkCommandList = new LinkedList<String>();
watermarkCommandList.add(_imageMagickCompositeBinary.getAbsolutePath());
watermarkCommandList.add("-watermark");
watermarkCommandList.add("100%");
if (tileWatermark) {
watermarkCommandList.add("-tile");
}
watermarkCommandList.add(watermarkFile.getAbsolutePath());
watermarkCommandList.add(outputFile.getAbsolutePath());
watermarkCommandList.add(outputFile.getAbsolutePath());
String[] watermarkCommands = watermarkCommandList.toArray(new String[watermarkCommandList.size()]);
try {
Result result = ERXRuntimeUtilities.execute(watermarkCommands, null, null, 0);
int exitValue = result.getExitValue();
if (exitValue != 0) {
log.warn("Warning: ImageMagick composite returned with a value of " + exitValue + ", error = " + result.getErrorAsString());
}
}
catch (Exception e) {
IOException ioex = new IOException("ImageMagick was interrupted.");
ioex.initCause(e);