Archived

This topic is now archived and is closed to further replies.

Low-quality image stretching

This topic is 5148 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Just for fun, I''m writing a small database app with C++. Each of the entries in the database can have a picture of any size associated with it, and when that entry is selected in a list, the image is resized and displayed in a box in the main window. Currently, I''m using StretchDIBits to draw the images, but it badly messes up the colors. here is a screenshot. That''s what it looks like when scaled down from 1024x768. Now, do you have any suggestions about what I could do to improve the image quality? Perhaps a workaround or another function? Or will I have to do drastic things like rewriting the image routines with OpenGL or DX for it to work (pretty unlikely, metinks)?
Member of the Un-Ban nes8bit Association (UNA) (to join put this in your sig) We are at war with Iraq. We have always been at war with Iraq. I love Big Brother. - DakeDesu

Share this post


Link to post
Share on other sites
You could use StretchBlt instead:

SetStretchBltMode(hdc, HALFTONE);
StretchBlt(etc....);

Unfortunately the HALFTONE option is not available on Win9x. only NT and upwards. It averages adjacent pixels when an image is shrunk, so it looks better that the other options, but slightly blurrier. I don''t know if StretchDIBits uses the SetStretchBltMode setting...

Capt Logic


Share this post


Link to post
Share on other sites
Thanks, I''ll try that out. I just realized that the picture I posted is actually the best one - all the others are far worse, so I really hope this does the trick.


Member of the Un-Ban nes8bit Association (UNA) (to join put this in your sig)

We are at war with Iraq. We have always been at war with Iraq. I love Big Brother.
- DakeDesu

Share this post


Link to post
Share on other sites