Example of Artistic Text from command line app

Oct 27, 2011 at 4:12 AM

I see the example of creating a QR Code using a Windows Forms application.

Is there a simple example of creating one from a simple command line app?

Also, is it possible to encode something that differs from the Artistic Text?

Here is what I have for now.

Thanks,

 glenn

 

QrEncoder qrEncoder = new QrEncoder ( ErrorCorrectionLevel.H );

 QrCode qrCode = qrEncoder.Encode( sTextToEncode );

 Renderer renderer = new Renderer( nSizeModule, Brushes.Black, Brushes.White);

renderer.CreateImageFile( qrCode.Matrix, sFilePNG,ImageFormat.Png );

 

Process.Start( sFilePNG );

 

Coordinator
Oct 27, 2011 at 7:17 AM

In class 

QrCodeNet\Gma.QrCodeNet\Gma.QrCodeNet.Demo\UsageSample.cs

you can find other usage samples.

Your code snippet seems to be ok. What else do you expect from console app?

Oct 27, 2011 at 3:34 PM

I would like to create a QR Code with some text in the middle -- from a command line app (i.e. not a Windows Forms application).

My real purpose is to create the QR Codes on a server dynamically.

The example in the demo area appears to rely on the Windows forms support. The QrCodeControl class is derived from the Control class.

The QrCodeControl is the only class that I see supports the 'Artistic' class which is used to render text on the created image.

Is there another mechanism to accomplish what I want to do?

 

thanks,

glenn

 

using System.Windows.Forms;

 

namespace Gma.QrCodeNet.Encoding.Windows.Controls

 

 

public class QrCodeControl : Control

 

 

Coordinator
Oct 28, 2011 at 8:04 AM

I see.

Unfortunately the artistic functionality is implemented only inside control.
You can request this feature (create new issue) to be extracted to renderer.
We will do our best to implement it. 

Jan 20, 2012 at 5:48 AM
Edited Jun 2, 2015 at 8:48 AM
Hi, there, you can use this qrcode reader
Apr 16, 2012 at 6:28 PM

Hi,

I would also like this functionality very much.

I guess that it must be hard to guarantee that the codes will be readable if custom images are used, but it seems possible to implement if you only allow text and restrict font-size and number of characters etc.

Any plans on implementing such feature in the future?

Thanks!

Coordinator
Apr 17, 2012 at 3:22 AM

I'm not sure if someone else wanna take that future implementation. For me, it's on low priority list. 

If you want to implement on your own, I could give some hint as following. 

1. Choose a error correction level. 

2. Create a temp QrCode with number of input text. (save as image file)

3. Wipe out part of center of QrCode, Let's say 2x2 modules. See if decoder can decode that QrCode. 

4. if it can, increase that wipe out region little bit and repeat test until you find a limit that decoder won't be able to analyse. 

5. Test for other length of input text, to get roughly idea about input text range and the size it can be wipe out. 

6. use QrCode control, graphic control you can just do some extra work at onPaint event, and WPF control you can put a rectangle as child of QrCode control. Once you have properly painted icon or text, Use DrawToBitmap to create image, or use RenderTargetBitmap to render WPF control. You should get what you want. 

 

For what you said allow text and restrict font size, that still can not guarantee readable by decoder. It depends on QrCode matrix size, Error correction level, area of module got wipe out, new item(text or icon) that place inside area covered how many lost module. 

The last part is most hardest part. The more module you can cover, (which include light colour module and dark colour module) the more likely that code is readable. 

I know someone implemented that with PHP or something, but it's very restrict, you can only put icon at centre, Icons are provide by that code, size is very small. Only in guarantee safe area.  Personally, I don't think people would satisfy with that half baked function.