展开全部
简单来说很简单
String s = "你的文字";
File file = new File("D:/image.bmp"); // 设置图片保存位置
Font font = new Font("Serif", Font.BOLD, 10);
//创建一个画布
BufferedImage bi = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
//获取画布的画笔
Graphics2D g2 = (Graphics2D)bi.getGraphics();
g2.drawString(s, 20, 20); //画出文32313133353236313431303231363533e58685e5aeb931333337386637字
try {
//将生成的图片保存为jpg格式的文件。ImageIO支持jpg、png、gif等格式
ImageIO.write(bi, "bmp", file);
} catch (IOException e) {
System.out.println("生成图片出错........");
e.printStackTrace();
}
// 至于有任何其他问题,和功能完善,请继续追问。