Juga tercantum di bawah ini:
mencoba {
String targetImg = "D:/Blue Hills.jpg";
// String tekanImg = "D:/20130311220300.jpg";
String pressImg = "D:/html_original.jpg";
File f1 = File baru(targetImg);
Gambar src = GambarIO baca (f1);
int lebar = src.getWidth(null);
int tinggi = src.getTinggi(nol);
Gambar BufferedImage = BufferedImage baru (lebar, tinggi, BufferedImage. TYPE_INT_RGB);
Grafik g = image.createGraphics();
g.drawImage(src, 0, 0, lebar, tinggi, null);
File f2 = File baru ( tekanImg ) ;
Gambar src_pao = ImageIO.read(f2);
int lebar_pao = src_pao.getWidth(null);
int height_pao = src_pao.getHeight(null);
g.drawImage(src_pao, (lebar-+pao_width)/2, (tinggi-pao_height)/2,pao_width, tinggi pao, null);
//g.drawImage (src_pao, 100, 100, lebar, tinggi, nol);
g.buang();
FileOutputStream keluar = FileOutputStream baru(targetImg);
Encoder JPEGImageEncoder = JPEGCodec.createJPEGEncoder(keluar);
encoder.encode(gambar);
keluar.dekat();
System.out.println("Keluaran plat nomor!!");
} tangkapan (Pengecualian e) {
// TODO : menangani pengecualian
System.out.println("Mantra hiburan!!");
e.printStackTrace();
} }