image resolutin probem RRS feed

  • Question

  • 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);



    Friday, November 7, 2008 4:25 AM


  • User815917640 posted

    You might want to try reducing image size (by half) OR try saving it as ImageFormat.Gif.

    Here's an article with links:



    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, November 7, 2008 9:36 AM