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 bufferedImage = ImageIO.read(new File("a.jpg"));
BufferedImage destinationBufferedImage = new BufferedImage(100, 100, BufferedImage.TYPE_INT_RGB);
Graphics2D g = destinationBufferedImage.createGraphics();
AffineTransform at = AffineTransform.getScaleInstance(2, 2);
g.drawRenderedImage(bufferedImage, at);
ImageIO.write(destinationBufferedImage, "JPG", new File("b.jpg"));
}
}
|