【发布时间】:2020-10-03 07:11:15
【问题描述】:
我正在尝试使用 java 运行 cmd 提示命令,我有一个源路径和目标路径,并且我正在翻转图像。翻转的图像应该被复制到目的地。图像被复制,但不是翻转的图像。我将在下面分享我的代码,如果需要其他任何内容,请告诉我。
@Test
public void executeCommandJpgDifferentPaths() throws IOException{
Path resourceDirectory = Paths.get("src\\main\\resources\\download.jpg");
Path destination = Paths.get(demoFolder.getAbsolutePath(),"download_output.jpg");
String command = "magick convert -flip resourceDirectory destination " ;
Boolean output = flipImplementation.executeCommand(command);
Files.copy(resourceDirectory,destination);
Assert.assertTrue(output);
try {
Thread.sleep(123456789L);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
【问题讨论】: