none
how to generate qr code for my personal image RRS feed

  • Question

  • I have personal image is 24 * 24 pixel i need to generate qr code for my personal image .

    i work in windows form c# 2015 windows form .

    i need to generate qr code for image .

    so that how to encode image to qr code and in same time not using internet to get image from publicity server

    OR if mobile not have internet i can get personal image from qr code when decoded or read it .

    Notes : I try more time to convert image to base 64 string and generating qr code

    for small image but when i read generated qr code it not read

    meaning there is thing wrong

    Sunday, January 1, 2017 12:29 AM

All replies

  • As I understand it, you want to encode a images binary data into a QR-code.

    While QR codes are mostly used for string data - and that string data is exceedingly often a URL leading to a (hopefully mobile friendly) webpage - there appears to be a encoding mode for storing binary data in QR codes:
    http://www.thonky.com/qr-code-tutorial/data-encoding

    I doubt the average QR code reader will be capable to expect and properly interpret image data. So you might have to write a app just for that. But it is not my area of expertise, so you should look for confirmation.

    Note that the smalest QR code appears to be at least 21x21 pixels in size. So unless this is about reliable reproduction or transmission via a monchrome medium (like greyscale printing), you are likely better off just printing that image to begin with.


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    Sunday, January 1, 2017 6:27 AM
  • Thank you for reply

    I need to make encoded to personal image to generated qr code

    as you understand 

    you are true

    but i have two question so that please try to help me answering theses questions

    1-How to convert image to 21 * 21 pixel to be small 

    2- what type of binary you need to convert image to it 0 and 1 

    or hexadecimal or what

    Sunday, January 1, 2017 10:21 AM
  • but i have two question so that please try to help me answering theses questions

    1-How to convert image to 21 * 21 pixel to be small 

    2- what type of binary you need to convert image to it 0 and 1 

    or hexadecimal or what

    These questions make no sense:

    1- A image of 21x21 pixels is insanely small by definition. The icons for the desktop tend to be at least 32x32 to 128x128 pixel. The file size of a image is defined as: [Height in pixels] times [Width in pixels] times [bytes of color information per pixel] (with some compression like jpg thrown in). Pick the smalest size where it is still understandable. That is how small you can make it. But that is a mater of image processing, not programming.

    2- What type of binary? There is only one type of binary called binary. The image related classes usually have a "to bytes" and "from bytes" function. And files on the disk are by definition a binary representation of the image.

    You need to give us some practical examples and show us your already existing code if you want any more help. As your situation or questions are not clearly understandable.


    Remember to mark helpfull answers as helpfull and close threads by marking answers.

    Sunday, January 1, 2017 2:23 PM
  • I do as following :

     public static byte[] ImageToBinary(string _path)
            {
                FileStream fS = new FileStream(_path, FileMode.Open, FileAccess.Read);
                byte[] b = new byte[fS.Length];
                fS.Read(b, 0, (int)fS.Length);
                fS.Close();
                return b;
            }
     private void ByteToBinary_Click(object sender, EventArgs e)
            {
                byte[] b = ImageToBinary("D://m2.jpg");
                string t= string.Concat(b.Select(x => Convert.ToString(x, 2).PadLeft(8, '0')));
                textBox1.Text = t;
            }

    This is my code as above i convert image  to byte then to binary 

    Before i convert image to 0 and 1 

    here i will generate

    private void Generate_Click(object sender, EventArgs e)
            {
                using (SaveFileDialog sv = new SaveFileDialog() { Filter = "JPEG|.jpg", ValidateNames = true })
                {
                    if (sv.ShowDialog() == DialogResult.OK)
                    {
                        MessagingToolkit.QRCode.Codec.QRCodeEncoder encoder = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();
                        encoder.QRCodeScale = 8;
                      
                        string encoding = textBox1.Text;
                        Bitmap bmp = encoder.Encode(encoding);
                        pictureBox1.Image = bmp;
                        path = sv.FileName;
                        bmp.Save(path, ImageFormat.Jpeg);
                    }
    
                }
            }

    And the following my image i need to encoded it

    it represent as above name 

    m2.jpg

    and his location in D drive



    Sunday, January 1, 2017 3:48 PM
  • Can any one tell me code above is correct or not

    because after generate qr and read by mobile reader not read

    Monday, January 2, 2017 10:36 AM
  • Are my encoder can understand binary 

    my result as following 

    11111111 11011000 11111111 11100000 00000000 00010000 01001010 01000110 01001001 01000110 00000000 00000001 00000001 00000001 00000000 01100000 00000000 01100000 00000000 00000000 11111111 11011011 00000000 01000011 00000000 00000010 00000001 00000001 00000010 00000001 00000001 00000010 00000010 00000010 00000010 00000010 00000010 00000010 00000010 00000011 00000101 00000011 00000011 00000011 00000011 00000011 00000110 00000100 00000100 00000011 00000101 00000111 00000110 00000111 00000111 00000111 00000110 00000111 00000111 00001000 00001001 00001011 00001001 00001000 00001000 00001010 00001000 00000111 00000111 00001010 00001101 00001010 00001010 00001011 00001100 00001100 00001100 00001100 00000111 00001001 00001110 00001111 00001101 00001100 00001110 00001011 00001100 00001100 00001100 11111111 11011011 00000000 01000011 00000001 00000010 00000010 00000010 00000011 00000011 00000011 00000110 00000011 00000011 00000110 00001100 00001000 00000111 00001000 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 11111111 11000000 00000000 00010001 00001000 00000000 00010000 00000000 00010000 00000011 00000001 00100010 00000000 00000010 00010001 00000001 00000011 00010001 00000001 11111111 11000100 00000000 00010101 00000000 00000001 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000110 00001000 11111111 11000100 00000000 00100101 00010000 00000000 00000010 00000001 00000011 00000010 00000111 00000000 00000011 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000010 00000011 00000100 00000101 00000110 00001000 00010010 00000000 00000111 00010001 00010011 00010100 00100001 00110001 00100010 00110010 01010001 11111111 11000100 00000000 00010101 00000001 00000001 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000100 00000101 11111111 11000100 00000000 00100100 00010001 00000000 00000001 00000011 00000001 00000111 00000101 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000010 00000011 00010001 00000000 00000100 00000101 00000110 00010010 00010100 00110001 01010001 00100010 01000001 01110001 11010001 11110001 11111111 11011010 00000000 00001100 00000011 00000001 00000000 00000010 00010001 00000011 00010001 00000000 00111111 00000000 10001110 11110100 00101001 10100001 11001110 01011111 11100110 10010100 10010001 11010110 01110011 00100111 00010000 10111111 11100100 01110000 01001011 00110100 01110100 10110110 10110011 01001111 00011100 10001101 01000001 01000100 10111110 00111111 01110010 01001001 01100110 00001000 11001011 11111011 00111001 00101011 10111000 11101110 11101000 01010001 01000111 01000001 11110111 10000001 00011010 10100111 11010010 01010101 10101111 00000001 10110110 01011110 10100001 11000111 00110001 11101100 10001010 11000101 10001100 00000100 10100111 10101101 10110101 11010001 11011110 00010001 10111100 10001010 00111110 11100000 10010001 01100101 10001000 00010010 11001100 01110110 11101110 10001000 00111000 00000101 10001001 00011101 11011111 11100111 01001110 00101011 11011101 00111100 01101010 00100111 00010100 11000111 10101011 11100010 11100101 11001101 10100110 10111110 01101010 10011010 10111000 01101101 01101111 01110001 10101001 10010110 00100010 10101001 00001011 00101010 01001000 10100000 10001000 11110111 00010101 11011110 01010100 11111110 01001100 01111010 10000000 00000111 10110000 01001111 01000011 11000000 01001100 10011111 01010111 10011000 11100110 10101101 00100000 11001011 00101101 00000110 11011111 01010010 11010110 11011011 01101101 01100010 01010010 11011010 11101110 10110001 10010001 00100111 10010111 00010010 11000101 10110101 10011010 01000101 11111010 00000000 01100100 11110100 01000111 11010101 01100001 11101011 11010111 00001011 01100101 01011001 01101111 00010101 10010101 00101011 10100111 11001001 10001000 11101100 00111000 11111000 01101010 10011101 10111011 01001010 01110000 11100011 00100101 10110100 00000000 11100100 11110000 00000010 10100100 01101110 01100111 01110010 00111101 10001010 11111111 11011001

    Please if any one can help

    Monday, January 2, 2017 10:39 PM
  • Hi eng-ahmed-salah,

    Thank you for posting here.

    If the binary got from the image and you want to convert it to QR code, please try the following code.

     static void Main(string[] args)
            {
                Barcode barcode = new Barcode();
    
                barcode.BarType = BarCodeType.QRCode;
    
                barcode.Data = "11111111 11011000 11111111 11100000 00000000 00010000 01001010 01000110 01001001 01000110 00000000 00000001 00000001 00000001 00000000 01100000 00000000 01100000 00000000 00000000 11111111 11011011 00000000 01000011 00000000 00000010 00000001 00000001 00000010 00000001 00000001 00000010 00000010 00000010 00000010 00000010 00000010 00000010 00000010 00000011 00000101 00000011 00000011 00000011 00000011 00000011 00000110 00000100 00000100 00000011 00000101 00000111 00000110 00000111 00000111 00000111 00000110 00000111 00000111 00001000 00001001 00001011 00001001 00001000 00001000 00001010 00001000 00000111 00000111 00001010 00001101 00001010 00001010 00001011 00001100 00001100 00001100 00001100 00000111 00001001 00001110 00001111 00001101 00001100 00001110 00001011 00001100 00001100 00001100 11111111 11011011 00000000 01000011 00000001 00000010 00000010 00000010 00000011 00000011 00000011 00000110 00000011 00000011 00000110 00001100 00001000 00000111 00001000 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 00001100 11111111 11000000 00000000 00010001 00001000 00000000 00010000 00000000 00010000 00000011 00000001 00100010 00000000 00000010 00010001 00000001 00000011 00010001 00000001 11111111 11000100 00000000 00010101 00000000 00000001 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000110 00001000 11111111 11000100 00000000 00100101 00010000 00000000 00000010 00000001 00000011 00000010 00000111 00000000 00000011 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000010 00000011 00000100 00000101 00000110 00001000 00010010 00000000 00000111 00010001 00010011 00010100 00100001 00110001 00100010 00110010 01010001 11111111 11000100 00000000 00010101 00000001 00000001 00000001 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000100 00000101 11111111 11000100 00000000 00100100 00010001 00000000 00000001 00000011 00000001 00000111 00000101 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000001 00000010 00000011 00010001 00000000 00000100 00000101 00000110 00010010 00010100 00110001 01010001 00100010 01000001 01110001 11010001 11110001 11111111 11011010 00000000 00001100 00000011 00000001 00000000 00000010 00010001 00000011 00010001 00000000 00111111 00000000 10001110 11110100 00101001 10100001 11001110 01011111 11100110 10010100 10010001 11010110 01110011 00100111 00010000 10111111 11100100 01110000 01001011 00110100 01110100 10110110 10110011 01001111 00011100 10001101 01000001 01000100 10111110 00111111 01110010 01001001 01100110 00001000 11001011 11111011 00111001 00101011 10111000 11101110 11101000 01010001 01000111 01000001 11110111 10000001 00011010 10100111 11010010 01010101 10101111 00000001 10110110 01011110 10100001 11000111 00110001 11101100 10001010 11000101 10001100 00000100 10100111 10101101 10110101 11010001 11011110 00010001 10111100 10001010 00111110 11100000 10010001 01100101 10001000 00010010 11001100 01110110 11101110 10001000 00111000 00000101 10001001 00011101 11011111 11100111 01001110 00101011 11011101 00111100 01101010 00100111 00010100 11000111 10101011 11100010 11100101 11001101 10100110 10111110 01101010 10011010 10111000 01101101 01101111 01110001 10101001 10010110 00100010 10101001 00001011 00101010 01001000 10100000 10001000 11110111 00010101 11011110 01010100 11111110 01001100 01111010 10000000 00000111 10110000 01001111 01000011 11000000 01001100 10011111 01010111 10011000 11100110 10101101 00100000 11001011 00101101 00000110 11011111 01010010 11010110 11011011 01101101 01100010 01010010 11011010 11101110 10110001 10010001 00100111 10010111 00010010 11000101 10110101 10011010 01000101 11111010 00000000 01100100 11110100 01000111 11010101 01100001 11101011 11010111 00001011 01100101 01011001 01101111 00010101 10010101 00101011 10100111 11001001 10001000 11101100 00111000 11111000 01101010 10011101 10111011 01001010 01110000 11100011 00100101 10110100 00000000 11100100 11110000 00000010 10100100 01101110 01100111 01110010 00111101 10001010 11111111 11011001";
    
                barcode.Width = 200;
                barcode.Height = 200;
    
                barcode.QRCodeECL = ErrorCorrectionLevelMode.L;
    
                barcode.PictureFormat = ImageFormat.Jpeg;
    
                barcode.CreateBarcode("qrcode.jpeg");
    
            }

    Here is the output.

    I hope this would be helpful.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Wednesday, January 4, 2017 10:35 AM
    Moderator
  • if i work in console application

    c#

    what name space i added to define the code above

    for barcode

    please help me

    Wednesday, January 4, 2017 10:38 PM
  • Hi eng-ahmed-salah,

    Thank you for feedback.

    Here is all the reference I added.

    using System;
    using System.Collections.Generic;
    using System.Text;
    using PQScan.BarcodeCreator;
    using System.Drawing.Imaging;
    using System.Runtime.Remoting.Metadata.W3cXsd2001;
    using System.IO;

    If it solves your problem, please mark the useful reply as answer.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, January 5, 2017 1:20 AM
    Moderator
  • Hi eng-ahmed-salah,

    If your question has been solved, please mark the useful reply as answer.

    This will make answer search easier in the forum and be beneficial to community members as well.

    Your understanding and cooperation would be grateful.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 30, 2017 2:35 AM
    Moderator
  • Hi Friends,

    Please help me I want to generate QR code of picture/image.

    thankyou.

    regards,

    asad


    asad

    Thursday, May 18, 2017 8:24 PM
  • but after generating 0101 format it cannot be scanned or its generate wrong data, Please I want to generate QR code of picture/image 

    thank you.

    regards,

    asad


    asad

    Thursday, May 18, 2017 8:26 PM