Image image
= src.getScaledInstance(width, height,
Image.SCALE_SMOOTH);
BufferedImage tag = new BufferedImage(width, height,
BufferedImage.TYPE_INT_RGB);
Graphics g = tag.getGraphics();
g.drawImage(image, 0, 0, null); // 绘制缩小后的图 g.dispose(); src = image;
} // 插入LOGO
Graphics2D
graph = source.createGraphics(); int x =
(QRCODE_SIZE - width) / 2; int y =
(QRCODE_SIZE - height) / 2;
graph.drawImage(src, x, y, width, height, null);
Shape shape
= new RoundRectangle2D.Float(x, y, width, width, 6, 6);
graph.setStroke(new BasicStroke(3f));
graph.draw(shape);
graph.dispose(); }
public
static void encode(String content, String imgPath, String destPath,
相关推荐: