I am using ImageQuick Tool to compress the DAM images. I am using below snippet for conversion.
try {
System.out.println(" Image is Processing :: " + assetDetails.getName() + "Original Size :: " + assetDetails.getSize());
ProcessBuilder pb = new ProcessBuilder("C:\\Program Files\\ImageMagick-6.9.9-Q16\\convert.exe", "-quality", "85%", assetDetails.getAssetNode().getPath(), assetDetails.getAssetNode().getPath());
pb.redirectErrorStream(true);
Process p = pb.start();
BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = br.readLine()) != null) {
System.out.println(line);
}
System.out.println(p.waitFor());
session.save();
} catch (final IOException | RepositoryException | InterruptedException ex) {
ex.printStackTrace();
}
Getting an error as below :
Image is Processing :: A.jpgOriginal Size :: 323.8 KB
convert.exe: unable to open image `/content/dam/A.jpg': No such file or directory @ error/blob.c/OpenBlob/2761.
convert.exe: no images defined `/content/dam/A.jpg' @ error/convert.c/ConvertImageCommand/3258.
Here code is looking for the file from /content/dam from local. How can I do this operation on existing images.
In case, I add the server name before path, I am getting below error :
convert.exe: no decode delegate for this image format `' @ error/constitute.c/ReadImage/504.
convert.exe: no data returned `http://localhost:4502/content/dam/A.jpg' @ error/url.c/ReadURLImage/247.
convert.exe: no images defined `http://localhost:4502/content/dam/A.jpg' @ error/convert.c/ConvertImageCommand/3258.