poor image quality of stretched images in vb6 image control.

Posted on 2004-10-26
Last Modified: 2012-05-05
I was hoping that someone can help me find a solution to this problem. I am writing a scanning application. I scan in images, then display them in different sized image controls. I have the stretch property turned on. The quality of the image displayed is extremely poor compared to the image that is displayed by other applications displaying the same file at the same physical size on the screen. Are there anyways to improved the quality of the stretched image? Or any controls that can do the same stretch but will not lower the quality so dramatically?
Question by:btetu
    LVL 32

    Accepted Solution

    Hi btetu

    Have a look here:
    Smooth picture Resizing ...(using Pixel sampling maybe)
    LVL 16

    Expert Comment

    The problem with the Image control's stretch method is that there is no interpolation; it simply multiplies the pixels to 'blocks', as it were (double size is pixelwidth * 2 x pixelheight * 2).

    You need to get the colour value of one pixel, the color values of the one to the right and the one below.  Then, you need to determine how many pixels away the new, resized, image will display the next pixel, then use this distance to determine by how much the first pixel's colour changes for every one pixel required to reach the destination of the second one, increasing/decreasing the colour values to match.

    I'm confusing myself just writing about it, so I suggest you use the class in the link provided by Erick37 -- it does all of that for you!!

    LVL 55

    Expert Comment

    by:Jaime Olivares
    Have a look to this control:
    LVL 1

    Author Comment

    Thanks Erik, that was very helpful. The quality is better, but i was still hoping for something more. When compared to the image generated by ms office at the same size is still 100x better. Damn microsoft! Thanks for your help.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

     Java Android Coding Bundle

    Whether you're an Apple user or Android addict, learning to code for the Android platform is an extremely valuable, in-demand skill. It all starts with Java, the language behind the apps and games that make Android the top platform it is today.

    Introduction This article makes the case for using two modules in your VBA/VB6 applications to provide both case-sensitive and case-insensitive text comparison operations.  Recently, I solved an EE question using the LIKE function.  In order for th…
    This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
    Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
    This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

    909 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    13 Experts available now in Live!

    Get 1:1 Help Now