Click here to Skip to main content
15,899,026 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
foreach (var a in lstr)
       {
            imgexts = a.Photo;
            if (imgexts != null)
           {
                imgname = Utility.Encrypt(string.Format(ComponentStockResearch.GetImageFormat(), a.StockResearchID)) + a.Photo;

                if (imgname != null)
                {
                   spath = Server.MapPath(Request.ApplicationPath) + "gallery/large/" + imgname;
                    if (System.IO.File.Exists(spath))
                    {

                        ComponentImageResize objImg = new ComponentImageResize();

                        Bitmap bmpimage = new Bitmap(spath, false);
                        System.Drawing.Image stockhome = objImg.CreateThumbNail(bmpimage, (int)ClsConvert.ToInt(Util.GetConfigKey("StockReaserch_List_W")), (int)ClsConvert.ToInt(Util.GetConfigKey("StockReaserch_List_H")));
                       stockhome.Save(Server.MapPath(Request.ApplicationPath) + "\\gallery\\StockResearchList\\" + imgname);
                        //stockhome.Save(Server.MapPath(Request.ApplicationPath) + "\\gallery\\featuredarticlehome\\" + spath);


                   }
               }
            }


What I have tried:

resize and save case the image occur white background in top and bottom of the image
Posted
Comments
Sinisa Hajnal 30-Mar-16 3:16am    
While resizing, do you keep side ratio same? That is, do you resize height as much as width? The borders you're describing are usually result of unbalanced resize where the system needs to fill in the blank are created.
Athul MS 31-Mar-16 1:54am    
not understand the answer

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