Results 1 to 5 of 5

Thread: Graphics interpolation issue

  1. #1
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2016
    Location
    Barcelona area
    Posts
    54
    Reputation
    28

    Graphics interpolation issue

    I'm using 2 pictureboxes, one with a source image and the other to zoom in on an area inside a navigation rectangle. I'm using DrawImage to magnify the image (image on the right)

    In the source image there is some text added with a graphics program. This text looks bad on the zoomed image due to interpolation. However, when I used StretchBlt with an old VB6 version of the application it looked OK (image on the left).

    Is there a way to "worsen the interpolation" to get a similar quality for the .Net version still using the graphics class? I don't care that much about the overall quality of the rest of the image.

    VB6.jpgNet.jpg

  2. #2
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    15,214
    Reputation
    2862
    If the source image is the same (quality) then the worse zoom is due to the Graphics.DrawImage. Graphics class has a small number of properties that could affect quality, you can try changing them to see if zoom improves. See documentation here and click "properties" in navigation to see the relevant properties you can modify: Graphics Class (System.Drawing) | Microsoft Docs
    [xcode=vb] code here [/xcode] - see bbcode list or use formatting buttons in posting editor.

    Visual Studio Community 2017

  3. #3
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2016
    Location
    Barcelona area
    Posts
    54
    Reputation
    28
    Quote Originally Posted by JohnH View Post
    If the source image is the same (quality) then the worse zoom is due to the Graphics.DrawImage. Graphics class has a small number of properties that could affect quality, you can try changing them to see if zoom improves. See documentation here and click "properties" in navigation to see the relevant properties you can modify: Graphics Class (System.Drawing) | Microsoft Docs
    Hi, I've spent the last few weeks in a hospital and finally I'm discharged.

    Getting back to my problem I have tried these properties (one at a time),

    Graphics.CompositingQuality
    Graphics.PixelOffsetMode
    Graphics.SmoothingMode
    Graphics.TextContrast
    Graphics.TextRenderingHint

    with different values but the result was always the same.

  4. #4
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    15,214
    Reputation
    2862
    Why not set them all? That's what I usually do, I find the documentation is not clear about when each property has a meaning.
    You also said "worsen the interpolation", but it sounds to me you should try the high quality settings to not see so much distortion when zoomed.
    [xcode=vb] code here [/xcode] - see bbcode list or use formatting buttons in posting editor.

    Visual Studio Community 2017

  5. #5
    .NET Framework
    .NET 4.5
    Join Date
    Dec 2016
    Location
    Barcelona area
    Posts
    54
    Reputation
    28
    Quote Originally Posted by JohnH View Post
    Why not set them all? That's what I usually do, I find the documentation is not clear about when each property has a meaning.
    You also said "worsen the interpolation", but it sounds to me you should try the high quality settings to not see so much distortion when zoomed.
    I have used all of them and tried various combinations of values, but I hardly see any change. Maybe there's a specific combintion of parameters for what I'm trying to achieve but I have the feeling I am going nowhere by fooling around with it.
    Perhaps I should go back to Bilblt.

Similar Threads

  1. New to Graphics
    By asokfair in forum Graphics/GDI+
    Replies: 2
    Last Post: 09-04-2013, 8:29 PM
  2. Replies: 0
    Last Post: 11-01-2011, 1:40 AM
  3. Question Graphics
    By DIZ in forum Windows Forms
    Replies: 3
    Last Post: 11-05-2010, 1:28 PM
  4. Graphics Help
    By christos57 in forum Graphics/GDI+
    Replies: 1
    Last Post: 03-09-2010, 9:09 AM
  5. 3D graphics
    By xintinx in forum Graphics/GDI+
    Replies: 2
    Last Post: 04-21-2009, 7:46 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •