ahmed salah

ahmed salah

  • NA
  • 530
  • 142k

How can i add personal image jpeg to qr code c#

Dec 25 2016 6:13 PM
How to encoded personal image and generate qr code for personal image ?
 
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 personal image
 
How to encoded personal image to be as encoded qr with related data ?
 
Meaning i need to generate qr code include customer name and address and cardno and
 
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 
  1. namespace MatrixBarcode  
  2. {  
  3.     public partial class Form1 : Form  
  4.     {  
  5.         public Form1()  
  6.         {  
  7.             InitializeComponent();  
  8.         }  
  9. //button1 to encoded all data i do all text but remaing image How to make  
  10.         private void button1_Click(object sender, EventArgs e)  
  11.         {  
  12.             if (textBox1.Text =="")  
  13.             {  
  14.                  
  15.                 MessageBox.Show("Please Enter Value ","Error");  
  16.                 textBox1.Focus();  
  17.             }  
  18.             else  
  19.             {   
  20.             using (SaveFileDialog sv = new SaveFileDialog() { Filter = "JPEG|.jpg", ValidateNames = true })  
  21.             {  
  22.                 if (sv.ShowDialog() == DialogResult.OK)  
  23.                 {  
  24.                     MessagingToolkit.QRCode.Codec.QRCodeEncoder encoder = new MessagingToolkit.QRCode.Codec.QRCodeEncoder();  
  25.                     encoder.QRCodeScale = 8;  
  26.                     string encoding="UserName : " + textBox1.Text + "\r\n" + "CardNo : " + textBox2.Text + "\r\n" + textBox3.Text;  
  27.                     Bitmap bmp = encoder.Encode(encoding);  
  28.                     pictureBox1.Image = bmp;  
  29.                     bmp.Save(sv.FileName, ImageFormat.Jpeg);  
  30.                 }  
  31.   
  32.             }  
  33.             }  
  34.   
  35.         }  
  36. //button2 for selecting personal image   
  37.         private void button2_Click(object sender, EventArgs e)  
  38.         {  
  39.             using (OpenFileDialog sv1 = new OpenFileDialog() { Filter = "JPEG|*.jpg", ValidateNames = true,Multiselect=false })  
  40.             {  
  41.                 if (sv1.ShowDialog() == DialogResult.OK)  
  42.                 {  
  43.                     pictureBox2.Image = Image.FromFile(sv1.FileName);  
  44.            
  45.   
  46.                 }  
  47.   
  48.             }  
  49.         }  
  50.   
  51.     }  
  52. }  
 

Answers (7)