Skip to content

二维码解析失败 #87

@qwe0099001

Description

@qwe0099001

用的使用手册里的二维码
image

代码
public Map qr(MultipartFile img) throws IOException, FormatException, ChecksumException, NotFoundException { Map<String,String> hashMap = new HashMap<>(); log.info(img.getOriginalFilename()); BufferedImage qrImg = ImageIO.read(img.getInputStream()); LuminanceSource source = new BufferedImageLuminanceSource(qrImg); BinaryBitmap bitmap = new BinaryBitmap(new HybridBinarizer(source)); QRCodeReader qrCodeReader = new QRCodeReader(); Result result = qrCodeReader.decode(bitmap); hashMap.put("res",result.getText()); return hashMap; }

报错如下
{ "timestamp": "2021-02-24T14:24:38.823+00:00", "status": 500, "error": "Internal Server Error", "trace": "com.google.zxing.NotFoundException\r\n", "message": "No message available", "path": "/qrdecode" }

普通的二维码没事。

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions