java - im4java convert to jpg, image crash -
i want convert images gif jpeg using im4java. there should 1 gif , 1 ipeg picture after excution. when i'v done this. there 3 pictures. 1 original gif, 1 new nomarl jpeg, , other 1 crashed jpeg picture. pictures may cause problems. may not. there know why? thanks
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; < picturearray.length; i++) { convertimage(picturearray[i].getabsolutepath(), "picture path" + + "." + format, format); } }
op.addimage(srcpath); here. because there more 1 picture in gif file.try op.addimage(srcpath+"[0]");
Comments
Post a Comment