带logo的二维码无法识别
horsen689 opened this issue · 3 comments
horsen689 commented
就按文档引入了jar包,然后copy了代码写了个测试类,对应的logo图片路径该成了本地的路径
二维码是生成了,但是用UC/QQ/其他软件挨个扫了遍,都无法识别
然后我怀疑是不是我的图片问题,就去用了百度来的图片,发现也识别不了
是不是有什么bug?
另外说一句:作者的东西做的很赞,至少用起来蛮爽的
com.github.hui.media
qrcode-plugin
2.2
// String logo = "/Users/horsen/Downloads/ywlogo.jpg";
String logo = "http://img1.imgtn.bdimg.com/it/u=2018939532,1617516463&fm=26&gp=0.jpg";
String msg = "https://liuyueyi.github.io/hexblog/2018/03/23/mysql之锁与事务详解/";
int size = 500;
try {boolean ans = QrCodeGenWrapper.of(msg) .setW(300) .setDrawPreColor(0xff0000ff) .setDrawBgColor(0xffffffff) .setDetectOutColor(0xff00FF00) .setDetectInColor(0xffff0000) .setPadding(1) .setLogo(logo) .setLogoRate(12) .setLogoStyle(QrCodeOptions.LogoStyle.ROUND) .setLogoBorder(true) .setLogoBgColor(Color.GREEN) .setBgOpacity(0.8f) .setBgStyle(QrCodeOptions.BgImgStyle.FILL) .setBgStartX(108) .setBgStartY(40) .asFile("/Users/horsen/Downloads/yyy.png"); } catch (IOException e) { e.printStackTrace(); } catch (WriterException e) { e.printStackTrace(); }
liuyueyi commented