I use QrCode.Net library version 0.3, and I need to use Gma.QrCodeNet.Encoding.Windows.Render to create images with qrcode ISizeCalculation , but I am missing something or not another version. What is the problem? In any case, I found a solution for people with the same problem, and they want to create images with the same fixed size. Here is the code:
private void gen_qr_file(string file_name, string content, int image_size) { string new_file_name = file_name; QrEncoder qrEncoder = new QrEncoder(ErrorCorrectionLevel.H); QrCode qrCode = new QrCode(); qrEncoder.TryEncode(content, out qrCode); Renderer renderer = new Renderer(image_size, Brushes.Black, Brushes.White); MemoryStream ms = new MemoryStream(); renderer.WriteToStream(qrCode.Matrix, ms, ImageFormat.Png); var image = new Bitmap(Image.FromStream(ms), new Size(new Point(200, 200))); image.Save(new_file_name + ".png", ImageFormat.Png); }
This generates a 200x200 pixel png image with qrcode.
There is a way in the library itself to do this, but I need to enable RENDER, and I cannot. Does anyone know what the problem is?
source share