# How to shrink image in high quaulity?

I want to shrink monochrome images in high quality. I have tried to use StretchBlt and set stretch mode to HALFTONE. The effect is very good but the HALFTONE mode doesn't support WIN9x. And I also tried to apply convolution algorithm to smooth images before shrinking, when the shrinking rate is not very high, say 0.4, the effect is acceptable, but if the rate is high, less than 0.3, the effect is bad. To improve the shrinking quality, I have convert the monochrome images from 1 bit to 8 bit format. Is there anyone know how do I shrink images in high quality?
###### Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Commented:
Convert them to gray scale when scaling down.

Algorithm is:-

For every pixel in destination bitmap
Work out a square/rectangle of pixels in source bitmap
X = The average color (black = 0, white=255) of pixels in this source square. Simply loop over this square, add up a running total, and at end divide by how many pixels in this square.
Set destination pixel color to RGB(X,X,X)

Example:

Assume scaling down by half: 2X2 square in monochrome, has 0, 1, 2 or 3 pixels set to white. If it's  This can means destination pixel is RGB(0,0,0), RGB(64,64,64), RGB(128,128,128),RGB(192,192,192) or RGB(255,255,255)

If you scale down by 1/3 or more, you're going to start losing data, but will work. You probably need to go 24 bit color at this point to get it to look really good.
0

Experts Exchange Solution brought to you by

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Author Commented:
Thank you very much, anwser2000. I have tried your algorithm in my program and the result turned out to be what I exactly want. I converted the bilevel bitmaps into gray scale bitmaps(8 bits per pixel), then selected a pallete created by myself which including 256 steps of gray scale.

I have thought my desired result must be gained through some complicated algorithm. I didn't expect it is so easy. The truth is always simple.
0
###### It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.