水印添加失败问题
This commit is contained in:
@@ -77,7 +77,7 @@ public class ImageWatermarkUtil {
|
|||||||
int width = original.getWidth();
|
int width = original.getWidth();
|
||||||
int height = original.getHeight();
|
int height = original.getHeight();
|
||||||
|
|
||||||
BufferedImage output = new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);
|
BufferedImage output = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
|
||||||
Graphics2D g2d = output.createGraphics();
|
Graphics2D g2d = output.createGraphics();
|
||||||
try {
|
try {
|
||||||
g2d.setBackground(Color.WHITE);
|
g2d.setBackground(Color.WHITE);
|
||||||
@@ -92,7 +92,6 @@ public class ImageWatermarkUtil {
|
|||||||
g2d.setColor(new Color(rgba[0], rgba[1], rgba[2], rgba.length > 3 ? rgba[3] : 128));
|
g2d.setColor(new Color(rgba[0], rgba[1], rgba[2], rgba.length > 3 ? rgba[3] : 128));
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
|
||||||
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
|
||||||
g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER));
|
|
||||||
|
|
||||||
double radians = Math.toRadians(watermarkProperties.getRotationDegrees());
|
double radians = Math.toRadians(watermarkProperties.getRotationDegrees());
|
||||||
int stepX = (int) (baseFontSize * watermarkProperties.getSpacingRatioX());
|
int stepX = (int) (baseFontSize * watermarkProperties.getSpacingRatioX());
|
||||||
|
|||||||
Reference in New Issue
Block a user