import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.image.BufferedImage;
import java.io.File;
import javax.imageio.ImageIO;
public class Main {
public static void main(String[] args) throws Exception {
BufferedImage bsrc = ImageIO.read(new File("a.jpg"));
BufferedImage bdest = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g = bdest.createGraphics();
AffineTransform at = AffineTransform.getScaleInstance(2, 2);
g.drawRenderedImage(bsrc, at);
ImageIO.write(bdest, "JPG", new File("b.jpg"));
}
}
|