[JAVA] Superposition de fichier image


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

Superposition de fichier image
Inclure les ressources d'image dans le fichier jar
Télécharger le fichier image de l'application Rails sur S3