Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8737477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T10:31:55+00:00 2026-06-13T10:31:55+00:00

I am trying to use MessagingToolkit to decode an image in C#/ASP.NET. I have

  • 0

I am trying to use MessagingToolkit to decode an image in C#/ASP.NET. I have managed to encode a qr using this package, but when i try to decode, using the code below it comes up with 2 errors (at the bottom of the page)

I believe this is because I am not getting the image correctly after uploading, but can someone point out exactly where I have gone wrong. Thanks.

    protected void CreateCode_OnClick(object sender, EventArgs e)
    {
        string path = "C:\\Users\\Wayneio\\Documents\\Visual Studio 2012\\Projects\\BAMSystem\\BAMSystem\\";
        if (QRUpload.HasFiles == true)
        {
            FileInfo fi = new FileInfo(QRUpload.FileName);
            string extA = fi.Extension;
            if (extA == ".jpg" || extA == ".png")
            {
               QRCodeDecoder decoder = new QRCodeDecoder();
               QRUpload.SaveAs(path + QRUpload.FileName);

               System.Drawing.Image myImg = System.Drawing.Image.FromFile(path + QRUpload.FileName);
               decoder.Decode(myImg);

            }
            else
            {
                error.Text = "You have uploaded a " + extA + " file. Please upload either a PNG or a JPG";
            }
        }
        else
        {
            error.Text = "You have not uploaded an image.";
        }
    }

Error1:

Error   2   Argument 1: cannot convert from 'System.Drawing.Image' to 'MessagingToolkit.QRCode.Codec.Data.QRCodeImage'  c:\users\wayneio\documents\visual studio 2012\Projects\BAMSystem\BAMSystem\default.aspx.cs  38  35  BAMSystem

Error2:

Error   1   The best overloaded method match for 'MessagingToolkit.QRCode.Codec.QRCodeDecoder.Decode(MessagingToolkit.QRCode.Codec.Data.QRCodeImage)' has some invalid arguments    c:\users\wayneio\documents\visual studio 2012\Projects\BAMSystem\BAMSystem\default.aspx.cs  38  20  BAMSystem

P.S if anyone has documentation on this MessagingToolkit QR package, it would be useful

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T10:31:56+00:00Added an answer on June 13, 2026 at 10:31 am

    Decode accepts ‘Bitmap’ type image.

    System.Drawing.Bitmap myImg = new System.Drawing.Bitmap(FileName);
    Dictionary<DecodeOptions, object> decodingOptions = new Dictionary<DecodeOptions, object>();
    List<BarcodeFormat> possibleFormats = new List<BarcodeFormat>(10);
    
                            possibleFormats.Add(BarcodeFormat.DataMatrix);
                            possibleFormats.Add(BarcodeFormat.QRCode);
                            possibleFormats.Add(BarcodeFormat.PDF417);
                            possibleFormats.Add(BarcodeFormat.Aztec);
                            possibleFormats.Add(BarcodeFormat.UPCE);
                            possibleFormats.Add(BarcodeFormat.UPCA);
                            possibleFormats.Add(BarcodeFormat.Code128);
                            possibleFormats.Add(BarcodeFormat.Code39);
                            possibleFormats.Add(BarcodeFormat.ITF14);
                            possibleFormats.Add(BarcodeFormat.EAN8);
                            possibleFormats.Add(BarcodeFormat.EAN13);
                            possibleFormats.Add(BarcodeFormat.RSS14);
                            possibleFormats.Add(BarcodeFormat.RSSExpanded);
                            possibleFormats.Add(BarcodeFormat.Codabar);
                            possibleFormats.Add(BarcodeFormat.MaxiCode);
    
     decodingOptions.Add(DecodeOptions.TryHarder, true);
     decodingOptions.Add(DecodeOptions.PossibleFormats, possibleFormats);
    Result decodedResult = decoder.Decode(myImg, decodingOptions);
    
              if (decodedResult != null)
                            {
                              //.. success
                            }
    

    Also you can also omit the “decodingOptions” options parameter as decoder also has an overload Decode(Bitmap image).

    System.Drawing.Bitmap myImg = new System.Drawing.Bitmap(FileName);
    Result decodedResult = decoder.Decode(myImg);
    
              if (decodedResult != null)
                            {
                              //.. success
                            }
    

    If you want only QRCode decoding,

        System.Drawing.Bitmap myImg = new System.Drawing.Bitmap(FileName);
        Dictionary<DecodeOptions, object> decodingOptions = new Dictionary<DecodeOptions, object>();
        List<BarcodeFormat> possibleFormats = new List<BarcodeFormat>();
        possibleFormats.Add(BarcodeFormat.QRCode);                              
        decodingOptions.Add(DecodeOptions.TryHarder, true);
        decodingOptions.Add(DecodeOptions.PossibleFormats, possibleFormats);
        Result decodedResult = decoder.Decode(myImg, decodingOptions);
         if (decodedResult != null)
           {
              //.. success
           }
    

    You can find documentation and code here
    http://platform.twit88.com/projects/show/mt-barcode

    Sample code ..download here ..has demo code also
    http://platform.twit88.com/projects/mt-barcode/files

    Code project here
    http://www.codeproject.com/Articles/20574/Open-Source-QRCode-Library

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying use MySql and Entity Framework, using Connector/Net 6.1 with this as
I am need paint my image. I'm trying use JQuery in here this link:
I have been trying use the edit_post_link() function to contain an image. All of
Anyone know how to create a cvCreateStructuringElementEx using a image? I'm trying use opencv.cv.cvCreateStructuringElementEx()
I was trying use svn to find a checkin using svn log, but it
i'm trying use webview to load a image from sdcard i use this path
I am trying use Thread but i have some problem (I am beginner at
Im trying use a Java annotation in a Groovy class but have trouble to
I'm trying use this code to get image resolution from file bool GetImageSizeEx(const char
I am trying use gem tire to search in my application. I have tables

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.