ReplaceColor

procedure ReplaceColor(oldColor, newColor: TColor32);


Replaces one color with another, but only where 'oldColor' exactly matches a pixel's color.

Example

  uses Image32, Image32_Extra, Image32_PNG;
  ...
  img := TImage32.Create;
  img.LoadFromFile('beetle_aq.png');
  //make aqua colored pixels transparent, but unlike EraseColor, 
  //here there's no accommodation for blended colors
  ReplaceColor(img, clAqua32, clNone32); 
  img.SaveToFile('beetle3.png');
  img.Free;
      
Before:
After:

See Also

EraseColor