夕頭抹慧嚥廬算
扮寂:2011-10-07 javaeye snowolf
宥狛斤夕頭嶷紙?器欺夕頭抹慧、儿抹園鷹廬算孔嬬。
Java旗鷹
import java.awt.Image;
import java.awt.image.BufferedImage;
import java.awt.image.RenderedImage;
import java.io.File;
import java.io.InputStream;
import java.io.OutputStream;
import javax.imageio.ImageIO;
/**
*
* @author 塑彊
* @version 1.0
* @since 1.0
*/
public abstract class ImageUtils {
/**
* 抹慧夕頭
*
* @param width
* 補竃錐業
* @param height
* 補竃互業
* @param input
* 補秘送
* @param output
* 補竃送
* @param format
* 補竃鯉塀
* @return
* @throws Exception
*/
public static boolean convert(int width, int height, InputStream input,
OutputStream output, String format) throws Exception {
// 補秘
BufferedImage inputImage = ImageIO.read(input);
// 廬算
RenderedImage im = (RenderedImage) convert(height, height, inputImage);
// 補 竃
return ImageIO.write(im, format, output);
}
/**
* 廬算儿抹麻隈
*
* @param input
* 補秘猟周
* @param output
* 補竃猟周
* @return
* @throws Exception
*/
public static boolean convert(File input, File output) throws Exception {
// 補秘
BufferedImage inputImage = ImageIO.read(input);
// 廬算
int width = inputImage.getWidth ();
int height = inputImage.getHeight();
RenderedImage im = (RenderedImage) convert(width, height, inputImage);
String outputFilename = output.getName ();
String format = outputFilename.substring(outputFilename
.lastIndexOf(''.'') + 1);
// 補竃
return ImageIO.write(im, format, output);
}
/**
* 抹慧夕頭
*
* @param width
* 補竃錐業
* @param height
* 補竃互業
* @param input
* 補秘猟周
* @param output
* 補竃猟周
* @return
* @throws Exception
*/
public static boolean convert(int width, int height, File input, File output)
throws Exception {
// 補秘
BufferedImage inputImage = ImageIO.read(input);
// 廬算
RenderedImage im = (RenderedImage) convert(width, height, inputImage);
String outputFilename = output.getName();
String format = outputFilename.substring(outputFilename
.lastIndexOf(''.'') + 1);
// 補竃
return ImageIO.write(im, format, output);
}
/**
* 抹慧夕頭
*
* @param width
* 補竃錐業
* @param height
* 補竃 互業
* @param input
* 補秘揃抄
* @param output
* 補竃揃抄
* @return
* @throws Exception
*/
public static boolean convert(int width, int height, String inputPath,
String outputPath) throws Exception {
return convert(width, height, new File(inputPath), new File (outputPath));
}
/**
* 廬算
*
* @param width
* 補竃錐業
* @param height
* 補竃互業
* @param input
|