weixin_39789399
2020-12-31 02:02How to get BW image as output - barcode.write() outputs 24 bit (Format24bppRgb) color image
How can I get a black and white image from barcode.write(). What I get is 24 bit 1.03MB big full color image.
I convert it to 1bpp with this
var x = ZXing.QrCode.Internal.ErrorCorrectionLevel.H;
var barcodeWriter = new BarcodeWriter
{
Format = barcodeFormat,
Options = new ZXing.QrCode.QrCodeEncodingOptions
{
CharacterSet = "ISO-8859-2",
Width = 600,
Height = 600,
ErrorCorrection = x,
QrVersion = 15
}
};
var bitmap = barcodeWriter.Write("ASDASD");
Console.Out.WriteLine(bitmap.PixelFormat);
var targetBmp = bitmap.Clone(new Rectangle(0, 0, bitmap.Width, bitmap.Height), pixelFormat.Format1bppIndexed);`
Console.Out.WriteLine(targetBmp.PixelFormat);
But barcodewriter first creates 24bit color 1MB big image, and then I convert it to 1 bit per pixel image which is 43Kb. Is there a parameter where I can set QR code to be just black and white? I have to create 2000 QR codes, and this is just too slow... :(
该提问来源于开源项目:micjahn/ZXing.Net
- 点赞
- 回答
- 收藏
- 复制链接分享
4条回答
为你推荐
- Golang错误-复合文字中缺少类型[重复]
- it技术
- 互联网问答
- IT行业问题
- 计算机技术
- 编程语言问答
- 1个回答
- WooCommerce:在可变产品页面中显示当前的SKU和GTIN
- sku
- barcode
- php
- 1个回答
- 通过表单执行SQL插入时填充会话UserID
- sql
- session-variables
- php
- 1个回答
- php image保存到目录并保存为pdf
- image-processing
- pdf-generation
- php
- 1个回答
- fopen($ filename,“a +”)和file_put_contents($ filename,= $ data.PHP_EOL,FILE_APPEND)似乎附加到文件
- fwrite
- php
- fopen
- 1个回答
换一换