如何在java中解码QRCode?我使用ZXing和QRCode,但有时它们不起作用

如何在java中解码QRCode?我使用ZXing和QRCode,但有时它们不起作用,java,zxing,Java,Zxing,使用ZXing对图像进行解码的方法: public static String decode(BufferedImage image) { try { if (image == null) { System.out.println("bufferedImage is null"); return null; } LuminanceSource source = new BufferedImag

使用ZXing对图像进行解码的方法:

public static String decode(BufferedImage image) {
    try {
        if (image == null) {
            System.out.println("bufferedImage is null");
            return null;
        }
        LuminanceSource source = new BufferedImageLuminanceSource(image);
        BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source));
        Result result;
        @SuppressWarnings("rawtypes")
        Hashtable hints = new Hashtable();
        hints.put(DecodeHintType.CHARACTER_SET, "utf-8");
        result = new MultiFormatReader().decode(bitmap, hints);
        String resultStr = result.getText();
        //System.out.println("the qrcode str: " + resultStr);
        return resultStr;
    } catch (com.google.zxing.NotFoundException re) {
        //System.out.println("no str in the image");
        return null;
    } catch(Exception e) {
        System.out.println(e.toString());
        return null;
    }

}
并使用QRcode.jar:

    public static String decodeUseQRcode(BufferedImage image){
        QRCodeDecoder decoder = new QRCodeDecoder();
        String content = null;
        try {
            content = new String(decoder.decode(new TwoDimensionCodeImage(image)),"gbk");
        } catch (DecodingFailedException e) {
            //e.printStackTrace();
            return null;
        } catch (UnsupportedEncodingException e) {
            //e.printStackTrace();
            return null;
        }
        return content;
    }
这张图片不能被QRCode.jar和ZXing解码,结果都是“null”。似乎这两个java方法都不能解码这张图片

但我使用微信和其他应用程序可以解码。 如何提高图片解码的成功率? (我没有10个声誉,所以我不能发布图片。这两种方法有时都有效,但并不总是有效。)
图片的链接

发布图片链接。@Nathantugy图片链接。