public static void test2() {
try {
// 读取第一张图片
// File fileOne = new File("D:qq.jpg");
// BufferedImage ImageOne = ImageIO.read(fileOne);
// int width = ImageOne.getWidth();//图片宽度
// int height = ImageOne.getHeight();//图片高度
// 对第二张图片做相同的处理
File fileTwo = new File("D:qq.jpg");
BufferedImage ImageTwo = ImageIO.read(fileTwo);
int width = ImageTwo.getWidth();// 图片宽度
int height = ImageTwo.getHeight();// 图片高度
int height2 = 20;
BufferedImage ImageOne = new BufferedImage(width, height2,
BufferedImage.TYPE_4BYTE_ABGR);
// ImageOne.get
Graphics g = ImageOne.getGraphics();//
g.fillRect(0, 0, width, height);
g.setColor(Color.blue);
Font mFont = new Font("宋体", Font.PLAIN, 12);
g.setFont(mFont);
<