如何修复使用 zxing 2.1 生成的不清楚的二维码图像? [英] how to fix an unclear qr code image generated using zxing 2.1?
问题描述
我使用zxing 2.1库生成了二维码图片,但是图片非常模糊不清.我可能哪里出错了?
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?
推荐答案
生成发生在较低级别,然后根据宽度和高度请求进行缩放.您可以请求以更高的宽度和高度生成.
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 在您可以设置的查看器中公开 BarcodeOptions.
ZXing exposes BarcodeOptions in the viewer that you can set.
在您的模型中,您可以这样做:
In your model you can do this:
public EncodingOptions BarcodeOptions => new EncodingOptions() { Height = 100, Width = 100, PureBarcode = true };
然后在您的 XAML 中它可能如下所示:
Then in your XAML it might look like this:
<z:ZXingBarcodeImageView BarcodeFormat="QR_CODE" HeightRequest="100" WidthRequest="100" Margin="10" BarcodeValue="a long url to a thing that accepts a zing to another thing"
BarcodeOptions="{Binding BarcodeOptions}" >
如果更改 XAML 上的宽度和高度,请记住更新 EncodingOptions 的宽度和高度.
Remember to update the width and height of your EncodingOptions if you change the width and height on your XAML.
这篇关于如何修复使用 zxing 2.1 生成的不清楚的二维码图像?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!