URL url = new URL("http://rz667qerk.hb-bkt.clouddn.com/1691721702296.jpg");
InputStream inputStream = url.openStream();
LuminanceSource source = new BufferedImageLuminanceSource(ImageIO.read(inputStream));
Binarizer binarizer = new HybridBinarizer(source);
BinaryBitmap binaryBitmap = new BinaryBitmap(binarizer);
Map<DecodeHintType, Object> hints = new HashMap<>();
hints.put(DecodeHintType.CHARACTER_SET, "UTF-8");
// 对收款码进行解码
Result imgresult = new MultiFormatReader().decode(binaryBitmap, hints);
String imgText = imgresult.getText();
System.out.println("二维码解码结果:==============》》》》" + imgText);
Java springboot zxing解析url图片二维码
最新推荐文章于 2023-08-18 09:33:25 发布