Solved

change image size without changing the resolution

Posted on 2013-06-03
1
931 Views
Last Modified: 2013-06-04
Hi Experts,
i created a simple code in C# to generate QRCode image size 197x197 for employees, my question is how to change the size without losing the quality.

protected void Page_Load(object sender, EventArgs e)
        {
            //--read employees information            
            string text, strSQL;
            strSQL = "select CPRNo, EngName,'1757' + OfficeTel as Tel,FaxNo,EmpEmail from GetUserDetailsE where PERUserName='mffinjm' ";
            EmpInfo empinfo = new EmpInfo();
            SqlDataReader sqlReader = null;
            using (SqlConnection con = GetConnectedPr())
            {
                SqlCommand myCommand = new SqlCommand(strSQL, con);
                sqlReader = myCommand.ExecuteReader();
                while (sqlReader.Read())
                {
                    empinfo.CPR = sqlReader["CPRNo"].ToString();
                    empinfo.EngName = sqlReader["EngName"].ToString();
                    empinfo.Tell = sqlReader["Tel"].ToString();
                    empinfo.email = sqlReader["EmpEmail"].ToString();
                    empinfo.Fax = sqlReader["FaxNo"].ToString();
                 }
             }                            
            //--Create QRCode
            QRCodeEncoder encoder = new QRCodeEncoder();
            text = "N:" +empinfo.EngName + ";TEL:"+ empinfo.Tell +";URL:http://www.mof.gov.bh;EMAIL:"+ empinfo.email +
                ";FAX:" + empinfo.Fax + ";NOTE:Ministry of Finance";
            Bitmap img = encoder.Encode(text);            
            img.Save(Server.MapPath("/images/"+ empinfo.CPR +".jpg"), ImageFormat.Jpeg);
            QRImage.ImageUrl = "~/images/" + empinfo.CPR + ".jpg";                  
        }

Open in new window


any suggestion

thank you
0
Comment
Question by:AZZA-KHAMEES
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 29

Accepted Solution

by:
Kumaraswamy R earned 500 total points
ID: 39218232
0

Featured Post

MS Dynamics Made Instantly Simpler

Make Your Microsoft Dynamics Investment Count  & Drastically Decrease Training Time by Providing Intuitive Step-By-Step WalkThru Tutorials.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question