public BufferedImage getCaptchaImage(String captchaStr, int width,
			int height) {
		BufferedImage retBufImage = null;
		Graphics graphicsLine = null;
		Graphics captchaImg = null;
		BufferedImage bufferImg = new BufferedImage(width, height,
				BufferedImage.TYPE_INT_RGB);
		try {
			graphicsLine = bufferImg.getGraphics();
			graphicsLine.setColor(new Color(Integer.parseInt("c0c0c0", 16)));
			graphicsLine.fillRect(0, 0, width, width);
			graphicsLine
					.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 30));
			graphicsLine.setColor(Color.GRAY);
			drawRandomLine(graphicsLine, 16);
			drawMessage(graphicsLine, captchaStr);

			ImageProducer source = bufferImg.getSource();
			ImageProducer producer = new FilteredImageSource(source, this);
			Image filteredImg = Toolkit.getDefaultToolkit().createImage(
					producer);
			retBufImage = new BufferedImage(width, height,
					BufferedImage.TYPE_INT_RGB);
			captchaImg = retBufImage.getGraphics();
			captchaImg.drawImage(filteredImg, 0, 0, null);
		} catch (RuntimeException e) {
			e.printStackTrace();
			throw new RuntimeException(e);
		} finally {
			if (graphicsLine != null)
				graphicsLine.dispose();
			if (captchaImg != null)
				captchaImg.dispose();
		}
		return retBufImage;
	}