Images, GDI+, Quality RRS feed

  • Question

  • User1173753381 posted


    I am trying to resize an image and I've made a canvas to draw the image in, I will also draw there some copyright stuff and DrawString etc. later.

    The problem is that all the images that I draw in the canvas, g.DrawImage etc. will be in s**t quality, REALLY bad quality!

    I want to make all the images that I draw in the canvas top quality. How do I achive this? The code is below.

    Thanks in advance!

    void Test()
      System.Drawing.Image image = System.Drawing.Image.FromFile("C:\\Inetpub\\wwwroot\\test10.jpg");
      System.Drawing.Image canvas = new Bitmap(205, 288, image.PixelFormat);

      Graphics g = Graphics.FromImage(canvas);

      g.CompositingQuality = CompositingQuality.HighQuality;
      g.SmoothingMode = SmoothingMode.HighQuality;
      g.InterpolationMode = InterpolationMode.HighQualityBicubic;

      g.DrawImage(image, 0, 0, 205, 288);

      canvas.Save("C:\\Inetpub\\wwwroot\\" + Guid.NewGuid() + "_Dildo_Dildo_12345.jpg", ImageFormat.Jpeg);


    Friday, March 17, 2006 5:33 PM

All replies