Click here to Skip to main content
15,890,438 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
Problem

How to encoded personal image and generate qr code for personal image with data related ?

Details

I work in visual studio 2015 using c# windows form application .

I need to encode personal image to qr code . Meaning when i select personal image

then click to generate it will generate qr code with personal image and related data as

user name and address and card no .

Until now i generated qr code with text data as address textbox and user name and card

no But No Personal Image .

Meaning i need to generate qr code include customer name and address and card no

And Image all done remaining image .

I do all data but cannot do image so that

How to encoded personal image and generate qr code for personal image ?

code i made until now to all data without image :


C#
//button1 to encoded all data i do all text but remaing image How to make  
        private void button1_Click(object sender, EventArgs e)  
        {  
            if (textBox1.Text =="")  
            {  

                MessageBox.Show("Please Enter Value ","Error");  
                textBox1.Focus();  
            }  
            else  
            {   
            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="UserName : " + textBox1.Text + "\r\n" + "CardNo : " + textBox2.Text + "\r\n" + textBox3.Text;  
                    Bitmap bmp = encoder.Encode(encoding);  
                    pictureBox1.Image = bmp;  
                    bmp.Save(sv.FileName, ImageFormat.Jpeg);  
                }  

            }  
            }  

        }  
//button2 for selecting personal image   
        private void button2_Click(object sender, EventArgs e)  
        {  
            using (OpenFileDialog sv1 = new OpenFileDialog() { Filter = "JPEG|*.jpg", ValidateNames = true,Multiselect=false })  
            {  
                if (sv1.ShowDialog() == DialogResult.OK)  
                {  
                    pictureBox2.Image = Image.FromFile(sv1.FileName);  


                }  

            }  
        }  

    }  
}


What I have tried:

I try to encode image to generate as qr code
Posted

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900