Image file overlay


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 "));
	}

}


Recommended Posts

Image file overlay
Include image resources in jar file
Upload Rails app image file to S3
Image upload