import java.awt.image.BufferedImage;
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class ImageIOTest {
public static void main(String args[]) throws IOException {
File inputFile = new File("c:\\11.jpg");
BufferedImage input = ImageIO.read(inputFile);
File outputFile = new File("c:\\test.gif");
ImageIO.write(input, "GIF", outputFile);
outputFile = new File("c:\\test.jpeg");
ImageIO.write(input, "JPEG", outputFile);
outputFile = new File("c:\\test.jpg");
ImageIO.write(input, "JPG", outputFile);
outputFile = new File("c:\\test.png");
ImageIO.write(input, "PNG", outputFile);
}
}
目前支持一下格式:
BMP, JPG,PNG, JPEG, WBMP, GIF
import java.io.File;
import java.io.IOException;
import javax.imageio.ImageIO;
public class ImageIOTest {
public static void main(String args[]) throws IOException {
File inputFile = new File("c:\\11.jpg");
BufferedImage input = ImageIO.read(inputFile);
File outputFile = new File("c:\\test.gif");
ImageIO.write(input, "GIF", outputFile);
outputFile = new File("c:\\test.jpeg");
ImageIO.write(input, "JPEG", outputFile);
outputFile = new File("c:\\test.jpg");
ImageIO.write(input, "JPG", outputFile);
outputFile = new File("c:\\test.png");
ImageIO.write(input, "PNG", outputFile);
}
}
目前支持一下格式:
BMP, JPG,PNG, JPEG, WBMP, GIF