package com.cnc.wsad.taskgenerator.frame;
import java.awt.Image;
import java.awt.geom.AffineTransform;
import java.awt.image.AffineTransformOp;
import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
import javax.swing.Icon;
import javax.swing.ImageIcon;
public class picturetest {
public static void getFixedIcon
(String filePath,
int width,
int height
) throws Exception{
double wRatio
= (new Integer(width
)).
doubleValue() / bi.
getWidth(); //宽度的比例
double hRatio
= (new Integer(height
)).
doubleValue() / bi.
getHeight(); //高度的比例
Image image
= bi.
getScaledInstance(width,height,
Image.
SCALE_SMOOTH); //设置图像的缩放大小
image = op.filter(bi,null);
int lastLength = filePath.lastIndexOf(".");
String subFilePath
= filePath.
substring(0,lastLength
); //得到图片输出路径
String fileType
= filePath.
substring(lastLength
); //图片类型
File zoomFile
= new File(subFilePath
+"_"+ width
+"_" + height
+ fileType
);
try{
e.printStackTrace();
}
}
public static void getfiled
(String path
){
File [] files
= file.
listFiles();
for (int i = 0; i < files.length; i++)
{
try {
int height = (ImageIO.read(file1)).getHeight(null);
int width = (ImageIO.read(file1)).getWidth(null);
String tts
= path
+"/"+file1.
getName(); //根据后缀判断
System.
out.
println(tts
+"||"+height
);
getFixedIcon(tts,width,height);
e.printStackTrace();
e.printStackTrace();
}
}
}
public static void main
(String arg
[]) {
getfiled("f:/游玩");
}
}