// 创建二维码位图
public static BufferedImage createQrImg(String content, Integer width, Integer height) throws Exception
{
Hashtable<EncodeHintType, Object> hints = new Hashtable<EncodeHintType, Object>();
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.H);
hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
// 生成矩阵信息
QRCodeWriter qrCodeWriter = new QRCodeWriter();
BitMatrix bitMatrix = qrCodeWriter.encode(content, BarcodeFormat.QR_CODE, width, height, hints);
// 遍历矩阵,获取矩阵中黑点开始的位置
int matrixWidth = bitMatrix.getWidth();
int matrixHeight = bitMatrix.getHeight();
Integer startX = null;
Integer startY = null;
for (int x = 0; x < matrixWidth; x++)
{
if(null!=startX){
break;
}
for (int y = 0; y < ma