Determining pixel width and height

Jun 10, 2016 at 1:05 PM
I'm a newbie to QR Code generation and I have a big question. When using this code to generate a bitmap image:

WriteableBitmap wBitmap = new WriteableBitmap ( numImageWidth, numImageHeigth, 96, 96, PixelFormats.Gray8, null );

Later I use this to do the rendering:

WriteableBitmapRenderer wRenderer = new WriteableBitmapRenderer ( new FixedModuleSize ( numPixelSize, QuietZoneModules.Two ), Colors.Black, Colors.White );

The NumPixelSize is 8 most of the time, but I had to make it 6 when I tried a 68 character text.

How do you determine the values for the width and height? I've been experimenting with different text content and have to manipulate the width and height variables to make the code come out right. For instance if there is only 15 or 20 characters, the value of both the width and height is 232. For 42 characters it is 235, etc.