/**
* 方法描述:<b>给图片增加水印.</b></br>
* 备 注: 在图片上写字符串
* 创 建 人: bo.gaobo</br>
* 创建日期: 2012-09-07</br>
* @param originalUrl 原始图片存储路径
* @param oldImg 原图片
* @param str 增加的字符串
* @param xLocation x坐标
* @param yLocation y坐标
* @param fontColor 颜色
* @param fontSize 字号
* @param typeFace 字体
* @param fileType 文件类型
*/
public static BufferedImage addStringToImg(String originalUrl, BufferedImage oldImg,String str,int xLocation,int yLocation, Color fontColor, int fontSize, String typeFace, String fileType) throws IOException{
FileOutputStream output = new FileOutputStream(originalUrl)
BufferedImage buffImg = oldImg
Graphics2D g = buffImg.createGraphics()
g = buffImg.createGraphics()
g.drawImage(buffImg, null, 0, 0)
g.setColor(fontColor)//设置字体颜色
g.setFont(new Font(typeFace, Font.PLAIN, fontSize))//设置字体和字号
g.drawString(str, xLocation, yLocation)//把字符串放在对应的坐标处
g.dispose()
ImageIO.write(buffImg, fileType, output)//设置文件类型
output.close()
return buffImg
}
水印弄在图片上的方法:打开美图app,首先在手机上找到并打开美图秀秀APP;
美化图片,在页面中所指处的“美化图片”;
点开文字
在页面中选择所指处的“文字”;
添加水印,在页面中选择处的“水印”,在图片上添加水印即可。
照片水印主要指的是现代的数字照片上面留下的一些logo、信息、网址什么的,图像,声音,视频信号等等在里面加了一些数字信息,这样是为了版权保护,当然加入水印也是不能影响原始文件的可读性以及观瞻的,水印具有以下几个特征,首先是证明各位是这个照片的原始主人,或者有的商家为了做宣传用,也会在照片上增加自己的网址,品牌名字等等。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)