Commit e6ed173a authored by 赵啸非's avatar 赵啸非

添加水印图片

parent f08c9624
...@@ -25,7 +25,7 @@ public class WatermarkImgUtils { ...@@ -25,7 +25,7 @@ public class WatermarkImgUtils {
Font font = new Font("宋体", Font.BOLD, 100);//水印字体,大小 Font font = new Font("宋体", Font.BOLD, 100);//水印字体,大小
Color markContentColor = Color.red;//水印颜色 Color markContentColor = Color.red;//水印颜色
Integer degree = 45;//设置水印文字的旋转角度 Integer degree = 45;//设置水印文字的旋转角度
float alpha = 0.5f;//设置水印透明度 float alpha = 0.3f;//设置水印透明度
OutputStream outImgStream = null; OutputStream outImgStream = null;
try { try {
File srcImgFile = new File(sourceImgPath);//得到文件 File srcImgFile = new File(sourceImgPath);//得到文件
...@@ -55,7 +55,7 @@ public class WatermarkImgUtils { ...@@ -55,7 +55,7 @@ public class WatermarkImgUtils {
columnsNumber = 1; columnsNumber = 1;
} }
g.drawString(waterMarkContent, width + width/2, width- width/2); g.drawString(waterMarkContent, width-150 , - 280);
/* for(int j=0;j<rowsNumber;j++){ /* for(int j=0;j<rowsNumber;j++){
boolean bool=false; boolean bool=false;
...@@ -88,7 +88,7 @@ public class WatermarkImgUtils { ...@@ -88,7 +88,7 @@ public class WatermarkImgUtils {
public static void main(String[] args) { public static void main(String[] args) {
WatermarkImgUtils.addWatermark("E:\\pic\\back.jpg", "E:\\pic\\back_water1.jpg", "你好,世界!", "jpg"); WatermarkImgUtils.addWatermark("E:\\pic\\1724379763618.jpg", "E:\\pic\\1724379763618_water1.jpg", "广安市一业一证(照)一码", "jpg");
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment