Solved

change image size without changing the resolution

Posted on 2013-06-03
1
918 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
1 Comment
 
LVL 29

Accepted Solution

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

Featured Post

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.
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 …

680 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