Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
Hi, I am trying to resize an image in a folder. The code am using is this

C#
string logoUrl = HttpContext.Current.Server.MapPath("DeviceLogo");
                System.Drawing.Image SourceLogo = System.Drawing.Image.FromFile(logoUrl + @"\" + objDevice.FileName);

                //Create a logo for this device and reseller/client business              
                Bitmap newImage = new Bitmap(objDevice.LogoWidth, objDevice.LogoHeight, PixelFormat.Format24bppRgb);
                using (Graphics graphics = Graphics.FromImage(newImage))
                {
                    graphics.CompositingQuality = CompositingQuality.HighQuality;
                    graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
                    graphics.SmoothingMode = SmoothingMode.HighQuality;
                    graphics.DrawImage(SourceLogo, 0, 0, objDevice.LogoWidth, objDevice.LogoHeight);
                }
                string filepath = HttpContext.Current.Server.MapPath("DeviceLogo");                

                //Save the resized image                
                newImage.Save(filepath + objDevice.FileName);


But its not working.The image is not getting resized Can anyine please help!!
Posted
Updated 3-Jun-13 1:42am
v2
Comments
CPallini 3-Jun-13 6:07am    
'But it is not working' is a poor informative sentence. I am sure you can do better.
Arjun Menon U.K 4-Jun-13 1:46am    
the problem is the image is not getting resized,no error is showing

1 solution

 
Share this answer
 
Comments
Arjun Menon U.K 3-Jun-13 6:20am    
The first link's the same as mine and it didn't work .:(

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