Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
one-certificate-system
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
赵啸非
one-certificate-system
Commits
0c5ef191
Commit
0c5ef191
authored
Aug 23, 2024
by
赵啸非
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加水印图片
parent
52992564
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
1 deletion
+5
-1
one-certificate-manager/src/main/java/com/mortals/xhx/common/utils/WatermarkImgUtils.java
.../java/com/mortals/xhx/common/utils/WatermarkImgUtils.java
+5
-1
No files found.
one-certificate-manager/src/main/java/com/mortals/xhx/common/utils/WatermarkImgUtils.java
View file @
0c5ef191
package
com.mortals.xhx.common.utils
;
package
com.mortals.xhx.common.utils
;
import
cn.hutool.core.img.Img
;
import
com.mortals.xhx.module.record.web.ApplyLogController
;
import
com.mortals.xhx.module.record.web.ApplyLogController
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
net.coobird.thumbnailator.Thumbnails
;
import
net.coobird.thumbnailator.Thumbnails
;
...
@@ -33,7 +34,10 @@ public class WatermarkImgUtils {
...
@@ -33,7 +34,10 @@ public class WatermarkImgUtils {
BufferedImage
read
=
ImageIO
.
read
(
new
File
(
sourceImgPath
));
BufferedImage
read
=
ImageIO
.
read
(
new
File
(
sourceImgPath
));
BufferedImage
bi
=
waterMarkByText
(
read
.
getWidth
(),
read
.
getHeight
(),
waterMarkContent
,
Color
.
RED
,
BufferedImage
bi
=
waterMarkByText
(
read
.
getWidth
(),
read
.
getHeight
(),
waterMarkContent
,
Color
.
RED
,
new
Font
(
"宋体"
,
Font
.
BOLD
,
100
),
45.0
,
0.3f
,
sourceImgPath
);
new
Font
(
"宋体"
,
Font
.
BOLD
,
100
),
45.0
,
0.3f
,
sourceImgPath
);
ImageIO
.
write
(
bi
,
fileExt
,
new
File
(
tarImgPath
));
Img
.
from
(
bi
).
write
(
new
File
(
tarImgPath
));
// ImageIO.write(bi, "jpg", new File(tarImgPath));
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
log
.
error
(
"添加水印失败"
,
e
);
log
.
error
(
"添加水印失败"
,
e
);
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment