I have generated a QR code image using zxing 2.1 library, but the image is very blurry and unclear. Where might I be possibly going wrong?
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
相关文章
- android开发 怎么把图片放入drawable的文件夹下
- android上如何获取/storage/emulated/下的文件列表
- androidStudio有个箭头不认识
- SQLite不能创建表
- Windows - Android SDK manager not listing any plat
- Animate Recycler View grid when number of columns
- Why is the app closing suddenly without showing an
- Android OverlayItem.setMarker(): Change the marker
The generation happens at a lower level and then is scaled with a width and height request. You can request generation at a higher width and height.
ZXing exposes BarcodeOptions in the viewer that you can set.
In your model you can do this:
Then in your XAML it might look like this:
Remember to update the width and height of your EncodingOptions if you change the width and height on your XAML.
I don't think there's anything wrong with the image you're creating. It's only when you're displaying it that it's coming out blurry.
You're generating a small QR code, with limited resolution in each direction. That's absolutely fine, but when it gets displayed, it needs to be scaled up appropriately. Whatever you're using to display the image (Android's default image viewer, maybe) is resampling the image and trying to reduce jagged edges. That's what you want if it's a photo, but quite inappropriate for a bar code, where you want it to be rescaled using a nearest neighbour algorithm. That way, it won't look blurry at all.
(It's hard to be absolutely certain about this unless you post the actual image rather than a screenshot, though.)