Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Graphics
  4. graphics quality very poor, how to improve?

graphics quality very poor, how to improve?

Scheduled Pinned Locked Moved Graphics
graphicstutorialquestioncode-review
8 Posts 6 Posters 7 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    joost versteegen
    wrote on last edited by
    #1

    I'm loading a image into the graphics of a form, but the quality is very poor. How to improve? The original image is 48*48 (96dpi). Here's my code:

    public partial class Form1 : Form
    {
    private ImageList ObjImageList;
    private int OPERSTEP_SIZE = 48;

    public Form1()
    {
      InitializeComponent();
    
      ObjImageList = new ImageList();
      ObjImageList.Images.Add("prodstep", Image.FromFile("ProdStep\_BW.gif"));
    
      this.Paint += new PaintEventHandler(Form1\_Paint);
    }
    
    void Form1\_Paint(object sender, PaintEventArgs e)
    {
      Graphics g = e.Graphics;
      g.DrawImage(ObjImageList.Images\["prodstep"\], new Rectangle(20, 20, OPERSTEP\_SIZE, OPERSTEP\_SIZE));
    }
    

    }

    M L T 3 Replies Last reply
    0
    • J joost versteegen

      I'm loading a image into the graphics of a form, but the quality is very poor. How to improve? The original image is 48*48 (96dpi). Here's my code:

      public partial class Form1 : Form
      {
      private ImageList ObjImageList;
      private int OPERSTEP_SIZE = 48;

      public Form1()
      {
        InitializeComponent();
      
        ObjImageList = new ImageList();
        ObjImageList.Images.Add("prodstep", Image.FromFile("ProdStep\_BW.gif"));
      
        this.Paint += new PaintEventHandler(Form1\_Paint);
      }
      
      void Form1\_Paint(object sender, PaintEventArgs e)
      {
        Graphics g = e.Graphics;
        g.DrawImage(ObjImageList.Images\["prodstep"\], new Rectangle(20, 20, OPERSTEP\_SIZE, OPERSTEP\_SIZE));
      }
      

      }

      M Offline
      M Offline
      Marco Bertschi
      wrote on last edited by
      #2

      The easiest way would probably be to use an image with a higher resolution than 48*48 but still display it as 48*48 - Are you sure the displayed image on the form is still 48*48? cheers, Marco

      Marco Bertschi


      CodeProject 10 Million members celebration meetup - Switzerland

      1 Reply Last reply
      0
      • J joost versteegen

        I'm loading a image into the graphics of a form, but the quality is very poor. How to improve? The original image is 48*48 (96dpi). Here's my code:

        public partial class Form1 : Form
        {
        private ImageList ObjImageList;
        private int OPERSTEP_SIZE = 48;

        public Form1()
        {
          InitializeComponent();
        
          ObjImageList = new ImageList();
          ObjImageList.Images.Add("prodstep", Image.FromFile("ProdStep\_BW.gif"));
        
          this.Paint += new PaintEventHandler(Form1\_Paint);
        }
        
        void Form1\_Paint(object sender, PaintEventArgs e)
        {
          Graphics g = e.Graphics;
          g.DrawImage(ObjImageList.Images\["prodstep"\], new Rectangle(20, 20, OPERSTEP\_SIZE, OPERSTEP\_SIZE));
        }
        

        }

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Please refer give links: Professional C# - Graphics with GDI+[^] Drawing smooth text and pictures on the extended glass area of your WinForm in Windows Vista[^]

        Maulik Dusara Sr. Sofware Engineer

        J K 2 Replies Last reply
        0
        • L Lost User

          Please refer give links: Professional C# - Graphics with GDI+[^] Drawing smooth text and pictures on the extended glass area of your WinForm in Windows Vista[^]

          Maulik Dusara Sr. Sofware Engineer

          J Offline
          J Offline
          joost versteegen
          wrote on last edited by
          #4

          Thanks for the information, i will check it out!

          1 Reply Last reply
          0
          • L Lost User

            Please refer give links: Professional C# - Graphics with GDI+[^] Drawing smooth text and pictures on the extended glass area of your WinForm in Windows Vista[^]

            Maulik Dusara Sr. Sofware Engineer

            K Offline
            K Offline
            Kamran Ayati
            wrote on last edited by
            #5

            you can use directx or gdi + tell me more about your question to help u .

            M 1 Reply Last reply
            0
            • K Kamran Ayati

              you can use directx or gdi + tell me more about your question to help u .

              M Offline
              M Offline
              Mr Nand Lal Gordhan Das Bheel
              wrote on last edited by
              #6

              install graphics drivers on ur pc

              Raisal

              T 1 Reply Last reply
              0
              • M Mr Nand Lal Gordhan Das Bheel

                install graphics drivers on ur pc

                Raisal

                T Offline
                T Offline
                Tino Fourie
                wrote on last edited by
                #7

                I did not find in the OP's question that he / she was having general problems with the quality of his / her display. The OP made it very clear that when he / she loads an image with a 48x48 dimension that the image he / she loaded was of poor quality. It is important that you understand the question before you post an absurd reply like you have just did. You should be ashamed of yourself.

                1 Reply Last reply
                0
                • J joost versteegen

                  I'm loading a image into the graphics of a form, but the quality is very poor. How to improve? The original image is 48*48 (96dpi). Here's my code:

                  public partial class Form1 : Form
                  {
                  private ImageList ObjImageList;
                  private int OPERSTEP_SIZE = 48;

                  public Form1()
                  {
                    InitializeComponent();
                  
                    ObjImageList = new ImageList();
                    ObjImageList.Images.Add("prodstep", Image.FromFile("ProdStep\_BW.gif"));
                  
                    this.Paint += new PaintEventHandler(Form1\_Paint);
                  }
                  
                  void Form1\_Paint(object sender, PaintEventArgs e)
                  {
                    Graphics g = e.Graphics;
                    g.DrawImage(ObjImageList.Images\["prodstep"\], new Rectangle(20, 20, OPERSTEP\_SIZE, OPERSTEP\_SIZE));
                  }
                  

                  }

                  T Offline
                  T Offline
                  Tino Fourie
                  wrote on last edited by
                  #8

                  An image with a dimension of 48x48 literally means that you have an image consisting of 48 * 48 pixels. If you load that image into a control with an Image property, and the said control's dimension are bigger than that of the image itself, the image will be stretched (zoomed) to fit the dimension of the control. However, in a Picturebox you can control how an image is displayed - zoomed, stretched, centered, etc. As mentioned before, try and use a higher resolution image. Higher resolution means a higher number of pixels. That will give you an image file with a greater dimension. The control you are using the display the image (other than a picturebox) will fit the image according to its own dimensions and not that of the image. Make sure that the control's dimensions are relative to that of the image to prevent the image from being distorted.

                  1 Reply Last reply
                  0
                  Reply
                  • Reply as topic
                  Log in to reply
                  • Oldest to Newest
                  • Newest to Oldest
                  • Most Votes


                  • Login

                  • Don't have an account? Register

                  • Login or register to search.
                  • First post
                    Last post
                  0
                  • Categories
                  • Recent
                  • Tags
                  • Popular
                  • World
                  • Users
                  • Groups