我有下面的Java代碼模糊的面孔圖像 - 變量convert
設置爲/usr/bin/mogrify
從Java不工作,直接調用ImageMagick的調用工作
//String []cmd = {convert, "-region", f.w+"x"+f.h+"+"+x+"+"+y, "-blur 0.0x10.0", path};
String cmd = convert + " -region " + f.w+"x"+f.h+"+"+x+"+"+y + " -blur 0.0x10.0 " + "\"" + path + "\"";
System.out.println(cmd);
// System.out.println(strJoin(cmd, " "));
Process p = Runtime.getRuntime().exec(cmd);
BufferedReader in = new BufferedReader(
new InputStreamReader(p.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
p.waitFor();
但沒有任何反應上的圖像。
該方案還輸出命令行會調用,例如:
/usr/bin/mogrify -region 37x44+1759+881 -blur 0.0x10.0 "/home/self/.wine/drive_c/windows/profiles/self/My Pictures/test/pic00164.jpg"
如果我手動調用這一行,一切工作正常。
正如您從註釋中看到的,我也嘗試提供cmd
爲一個數組,應自動逃避我的道路空間 - 同樣的效果:無。
一切正常。用'p.getErrorStream嘗試()',而不是'p.getInputStream()'獲取錯誤的描述。 – 2014-12-07 19:03:49