int src_width = bg_src.getWidth(null); int src_height = bg_src.getHeight(null); BufferedImage tag = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
//g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_ATOP, 1.0f)); // 透明度设置 int x = 0; int y = 0; for(int i = 0; i < column; ++i){ y = 0; for (int j = 0; j < row; ++j) { g2d.drawImage(bg_src, x, y, src_width, src_height, null); y += src_width; } x += src_height; } //g2d.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER)); // 透明度设置 结束
FileOutputStream out = new FileOutputStream(outPng); ImageIO.write(tag, "png", out);// 写图片 out.close(); } catch (Exception e) { e.printStackTrace(); } }