LoginSignup
0
0

More than 3 years have passed since last update.

イメージファイル重ね合わせ

Last updated at Posted at 2020-04-02

public class ImageTest {

    public static void main(String[] args) throws IOException {
        BufferedImage bufferedImage1 = ImageIO.read(new File("C:\\image_test\\tree.jpg"));
        BufferedImage bufferedImage2 = ImageIO.read(new File("C:\\image_test\\star2.png"));

        Graphics graphics1 = null;

        try {
            graphics1 = bufferedImage1.getGraphics();
            int x = 2;
            int y = 2;
            graphics1.drawImage(bufferedImage2, x, y, null);

        } finally {
            graphics1.dispose();
        }

        ImageIO.write(bufferedImage1, "jpg", new File("C:\\image_test\\dst_jpg2.jpg"));
    }

}
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0