1
im4java를 사용하여 이미지를 gif에서 jpeg로 변환하고 싶습니다. 퇴출 후에는 하나의 gif와 하나의 ipg 사진이 있어야합니다. 하지만 내가 이것을했을 때. 사진이 3 장 있습니다. 하나는 원래 gif이고, 하나는 새로운 nomarl jpeg이고 다른 하나는 jpeg 그림입니다. 일부 사진으로 인해이 문제가 발생할 수 있습니다. 일부는 그렇지 않을 수도 있습니다. 이유를 아는 사람이 있습니까? 감사합니다im4java jpg로 변환, 이미지 충돌
public static void convertImage(String srcPath, String newPath, String format)
throws Exception
{
IMOperation op = new IMOperation();
op.addImage(srcPath);
op.addImage(newPath);
System.out.println(op);
ConvertCmd cmd = new ConvertCmd();
cmd.run(op);
}
public static void changePictures(String format) throws Exception
{
File file = new File("picture path");
File pictureArray[];
pictureArray = file.listFiles();
int i;
for(i = 0; i < pictureArray.length; i++)
{
convertImage(pictureArray[i].getAbsolutePath(), "picture path" + i + "." + format, format);
}
}