Code
Import Java.awt.font;import java.awt.graphics;import Java.awt.image;import Java.awt.image.bufferedimage;import Java.io.file;import Java.io.fileoutputstream;import Com.sun.image.codec.jpeg.jpegcodec;import Com.sun.image.codec.jpeg.jpegimageencoder;import Javax.imageio.imageio;public class WaterMark{public static void Pressimage (String dst,string src,int x,int y) {try{file f=new File (src); Image img=imageio.read (f); int W=img.getwidth ( NULL); int h=img.getheight (NULL); BufferedImage bimg=new BufferedImage (W, H, Bufferedimage.type_int_rgb); Graphics g=bimg.getgraphics (); G.drawimage (img, 0, 0, W, h, NULL); File F1=new file (DST), Image Img1=imageio.read (F1), int w1=img1.getwidth (NULL), int h1=img1.getheight (NULL); G.drawimage (IMG1, W-w1-x, h-h1-y, W1, H1, NULL); G.dispose (); FileOutputStream out=new FileOutputStream (DST); JPEGImageEncoder Encoder=jpegcodec.createjpegencoder (out); Encoder.encode (bimg); Out.close ();} catch (Exception e) {e.printstacktrace ();}} public static void Presstext (String presstext, String Targetimg,string fontname,int fontstyle,int color,int fontsize,int x,int y) {try{file f=new File (TARGETIMG); Image img= Imageio.read (f); int w=img.getwidth (null); int h=img.getheight (NULL); BufferedImage bimg=new BufferedImage (W,H,BUFFEREDIMAGE.TYPE_INT_RGB); Graphics g=bimg.getgraphics (); G.drawimage (img, 0, 0, W, h, null); G.setfont (new Font (fontname,fontstyle,fontsize)); g.DrawString (Presstext, W-fontsize-x, h-fontsize/2-y); G.dispose (); FileOutputStream out=new FileOutputStream (targetimg); JPEGImageEncoder Encoder=jpegcodec.createjpegencoder (out); Encoder.encode (bimg); Out.close ();} catch (Exception e) {e.printstacktrace ();}} public static void Main (string[] args) {pressimage ("1.jpg", "2.jpg", 200,200);p resstext ("Really good Miss You", "3.jpg", "Arial", font.bold,0,20,200,200);}}
Java Picture plus watermark