I am trying to resize a Bitmap using the below code, I am receiving an error on the 2nd line:
Image src = Image.FromFile(@"D:\Microsite\TestASP\Images\logo.png");
Bitmap newImage = new Bitmap(600,600); //error occurs on this line
using (Graphics gr = Graphics.FromImage(newImage))
{
gr.SmoothingMode = SmoothingMode.HighQuality;
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
gr.DrawImage(src, new Rectangle(0, 0, 300, 300));
}
The error I get is
url formats not supported
I suspect your D drive is mapped to somewhere other than the local machine.
Try this instead of your first line (I know it’s not very pretty, it’s testing a hunch):