Not much nonsense directly on the code, the code is actually not much ....
PackageCom.qiao.testImage;ImportJava.awt.image.BufferedImage;ImportJava.io.File;Importjava.io.IOException;Importjava.util.ArrayList;Importjava.util.List;ImportJavax.imageio.ImageIO; Public classImagechange { Public Static voidMain (string[] args)throwsIOException {List<String> item=NewArraylist<string>(); File File=NewFile ("D:\\test\\temp\\temp"); file[] Files=file.listfiles ();//System.out.println ("Files Length" +files.length); for(inti = 0; i < files.length; i++) {File file1=Files[i]; File1.getname ();//System.out.println ("Output file suffix name" +file1.getname ()); if(File1.getname (). IndexOf (". jpg") >-1) {Item.add ("D:\\test\\temp\\temp\\" +files[i].getname ()); System.out.println ("Output file Files[i].getname ():" +files[i].getname ()); } } for(inti = 0; I < item.size (); i++) {System.out.println ("Item collection Internal data" +Item.get (i)); String type= "png"; File src=NewFile (Item.get (i)); File dir=NewFile ("D:\\test\\image"); Trans (src, dir, type); } } Public Static voidTrans (File imgfile,file outdir,string type)throwsioexception {bufferedimage img=Imageio.read (Imgfile); //Set file nameString SrcName = Imgfile.getname (). replace (". jpg", "") + "." +type; File out=NewFile (outdir+file.separator+SrcName); Imageio.write (img,type,out); }}
Java Bulk conversion picture format
Java Bulk Conversion Picture format