Commit 3cbb61d3 by 王祖波

优化黑线问题

parent 30a41d42
......@@ -42,11 +42,11 @@ public class ImageCombined {
private static final int QR_WIDTH_REFERENCE = 136;
private static final String LARGE_IMAGE_URL = "https://wcy-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-0e89ce4dc0454998a16e5295a32e13ba.jpg?imageView2/2/w/1080/h/10800/format/jpg";
private static final String LARGE_IMAGE_URL = "https://jhdmyx-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-191564494842458980f5c5ae685d3440.jpg?imageView2/2/w/1080/h/10800/format/jpg";
private static final String QR_CODE_URL = "https://gicinner-1251519181.cos.ap-shanghai.myqcloud.com/image/material_content-4ffc77073ca1476fb264bf1be9f11383.png";
private static final String STORE_NAME = "门店CCA";
private static final String GUIDE_NAME = "宇智222为您推荐";
private static final String OUTPUT_PATH = "/Users/wang/Downloads/output_image4.jpg";
private static final String OUTPUT_PATH = "/Users/wang/Downloads/output_image5.jpg";
static {
ImageIO.scanForPlugins(); // 初始化图像插件
......@@ -138,13 +138,16 @@ public class ImageCombined {
}
width = Math.max(width, MIN_WIDTH);
}
BufferedImage resizedImage = Thumbnails.of(image).size(width, height).asBufferedImage();
int finalHeight = height + (showStyle == 1 ? 0 : WHITE_SPACE_HEIGHT);
BufferedImage combinedImage = new BufferedImage(width, finalHeight, BufferedImage.TYPE_INT_RGB);
BufferedImage resizedImage = Thumbnails.of(image)
.size(width, height).asBufferedImage();
Graphics2D g = combinedImage.createGraphics();
g.drawImage(resizedImage, 0, 0, null);
g.setColor(Color.WHITE);
g.drawImage(resizedImage, 0, 1, null);
if (showStyle == 1) {
qrWidth = width * QR_WIDTH_REFERENCE / 750;
}
......
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