CopyCode The Code is as follows: Try {
String targetimg = "D:/blue hills.jpg ";
// String pressimg = "D:/20130311220300.jpg ";
String pressimg = "D:/html_original.jpg ";
File F1 = new file (targetimg );
Image src = ImageIO. Read (F1 );
Int width = SRC. getwidth (null );
Int Height = SRC. getheight (null );
Bufferedimage image = new bufferedimage (width, height, bufferedimage. type_int_rgb );
Graphics G = image. creategraphics ();
G. drawimage (SRC, 0, 0, width, height, null );
File F2 = new file (pressimg );
Image src_pao = ImageIO. Read (F2 );
Int width_pao = src_pao.getwidth (null );
Int height_pao = src_pao.getheight (null );
G. drawimage (src_pao, (width-+ width_pao)/2, (height-height_pao)/2, width_pao, height_pao, null );
// G. drawimage (src_pao, 100,100, width, height, null );
G. Dispose ();
Fileoutputstream out = new fileoutputstream (targetimg );
Required imageencoder encoder = required codec. createjpegencoder (out );
Encoder. encode (image );
Out. Close ();
System. Out. println ("watermark added successfully !! ");
} Catch (exception e ){
// Todo: handle exception
System. Out. println ("failed to add watermark !! ");
E. printstacktrace ();
}