Solved

change image size without changing the resolution

Posted on 2013-06-03
1
864 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
Comment Utility
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …

728 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now