User-1532855418 posted
Hi all,
I am facing a problem with image resolution. I need to set image resoution through my code.So client could download different resolutoin image. But when I set resolution whatever it it .It always shows a fixed size.exam If
the original image 3.4mb and resolution 300dpi. If i set it to 200dpi it shows 344kb when i set setresolution 72 it shows 344 kb . I dont know where is the problem.Here is my code.
System.Drawing.
Image oImg = System.Drawing.Image.FromFile(LinkHelper.ImageLocations.ImageServerLocation(Request.PhysicalApplicationPath,
IId));
int width = oImg.Width;
int height = oImg.Height;
Bitmap bitmay =
new Bitmap(oImg.Width, oImg.Height);
bitmay.SetResolution(200f, 200f);
Graphics g = Graphics.FromImage(bitmay);
g.DrawImage(oImg,
new
Rectangle(0, 0, width, height),
new Rectangle(0, 0, width, height),
GraphicsUnit.Pixel);
bitmay.Save(filePathServer, System.Drawing.Imaging.
ImageFormat.Jpeg);