Click here to Skip to main content
15,881,248 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more:
i m decreasing the resolution of a bitmap. i found a method on a site which is as follows

Average the values of all surrounding pixels, store that value in the choosen pixel location, then delete all the surrounding pixels.so a 4*6 matrix becomes a 4 x 3 matrix.

i am accessing pixels by this code
C++
for(int y = 0; y < bmp.bmHeight; y++)
  {
      for(int x = 0; x < bmp.bmWidth; x++)
      {
          COLORREF rgb = dc.GetPixel(x, y);
          BYTE r = GetRValue(rgb);
          BYTE g = GetGValue(rgb);
          BYTE b = GetBValue(rgb);
          dc.SetPixel(x, y, RGB(r,g,b));
      }
  }


tell me how can i delete a pixel?
Posted
Updated 25-Jun-10 22:56pm
v2

1 solution

I don't think you can (or would really want to for that ,matter, it would smash the loop performing the averages).

What you need to do IMO is to create a target .bmp at the size of the new resolution, and copy the averaged values into corresponding pixel. This will also leave you an "revert" option for future use.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900