真急啊
public static void main(String[] args) throws Exception{
String inputFile = "c:/a.tif";
String outputFile = "c:/a.jpg";
RenderedOp src = JAI.create("fileload", inputFile);
OutputStream os = new FileOutputStream(outputFile);
JPEGEncodeParam param = new JPEGEncodeParam();
ImageEncoder enc = ImageCodec.createImageEncoder("JPEG", os,param);
enc.encode(src);
src.dispose();
os.flush();
os.close();
File file = new File(inputFile);
if(file.exists())
System.out.println(file.delete());
}
这段代码是把tif图片转换成jpg图片 之后删除。
现在的问题是转换成功只后不能删除。原因是原图片正在使用,可能是因为流或者别的没关掉。可是我已经关闭了OS