Click here to Skip to main content
Click here to Skip to main content

QRCode library for Windows 8 based on the solution from twit88

, 11 Feb 2013
Rate this:
Please Sign up or sign in to vote.
Generate and decode QR code.


QR code library ported to Windows 8 based on the solution from twit88:


Recently I was looking for a QR code library to read and generate QR codes for Windows Metro style apps. Since I could not find one for Windows 8 but I found this excellent work from twitt88, I decided to make a port for Windows Metro style apps.

Using the code  

Please notice that the attached code is based on the following library: 

Please visit the site for additional solutions as well.

The next section shows how to use the library.

Note: The QR encoding and decoding functions using image in a byte array format.

Generating QR Code:  

ThoughtWorks.QRCode.Codec.QRCodeEncoder _qrCodeEncoder = new
_qrCodeEncoder.QRCodeEncodeMode = QRCodeEncoder.ENCODE_MODE.BYTE;
_qrCodeEncoder.QRCodeErrorCorrect = QRCodeEncoder.ERROR_CORRECTION.Q;
_qrCodeEncoder.QRCodeVersion = 0;
_qrCodeEncoder.QRCodeScale = 7;
string text = "Test text for QRcode";
QRCodeBitmapImage image = _qrCodeEncoder.Encode(text, System.Text.Encoding.UTF8);

Please notice that the encoder returns a QRCodeBitmapImage which contains the image in a byte[] array format.  The Utilities class contains a static method that can be used to create a WritableBitmap instance that can be used as a source of an Image object.

Reading QR Code: 

QRCodeBitmapImage _image = new QRCodeBitmapImage(_imagetoBeRead, _width, _height);
decodedstring = _decoder.decode(_image, System.Text.Encoding.UTF8);

The imageToBeRead is a byte[] array of the image to be read. This can be created from a WritableBitmap as the following line shows: 


For using the ToArray() method for the WriteableBitmap you have to include the following namespace to your project:

using System.Runtime.InteropServices.WindowsRuntime;

Points of Interest 

The code can be used for reading and generating QR codes.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Hungary Hungary
No Biography provided

Comments and Discussions

Questionqr code generating PinmemberKtueethall Lee29-Jun-14 18:08 
GeneralMy vote of 5 Pinmembershab9ard30-Aug-13 15:56 
Questioncan this post solve this issue Pinmembercathyhill25-Jun-13 16:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web03 | 2.8.140827.1 | Last Updated 11 Feb 2013
Article Copyright 2013 by M_Tamas
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid