Sweety Khan
Sweety Khan

Reputation: 81

how can a pixel in a bitmap can be deleted?

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

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?

Upvotes: 0

Views: 663

Answers (1)

GManNickG
GManNickG

Reputation: 504313

You can't really delete a pixel, a bitmap is a matrix of pixels. Rather, you should make a new bitmap of the intended size, and copy pixels into that.

Upvotes: 4

Related Questions