1

I want to shrink a large bitmap such that all source pixels are averaged into the destination pixels. I'm aware that Graphics DrawImage cannot do this regardless of InterpolationMode. For speed and safe code, I want to use a Windows library function. It there one that will do this?

ChrisJJ
  • 2,191
  • 1
  • 25
  • 38

1 Answers1

1

This MSDN article describes how to perform interpolation using WinAPI. However, since you are compressing, not expanding, you may well get away with using StretchBlt in conjunction with SetBltStretchMode (try HALFTONE or COLORONCOLOR and see what gives you better results).

Mike Kwan
  • 24,123
  • 12
  • 63
  • 96
  • Thanks but COLOURONCOLOUR's description makes clear it does not do what's required, and nothing in HALFTONE's description suggests it does. Also (please correct me if I am wrong) but surely StretchBlt is not permitted in safe code. – ChrisJJ Feb 08 '12 at 23:09
  • 1
    "and nothing in HALFTONE's description suggests it does" this is true, yet HALFTONE is commonly used to achieve bilinear interpolation (the dithering is a thing of past with todays 24b/32b modes). See also http://stackoverflow.com/a/4358798/16673 or http://stackoverflow.com/questions/4572886/ – Suma Mar 23 '12 at 11:49