The "ImageEn" way is:
var
oldColor, newColor, transpColor:TRGB;
...other variables
begin
ImageEnView1.IO.LoadFromFile('20117195814_Analysis.bmp');
// replace all pixels with "oldColor" with "newColor"
oldColor := CreateRGB(255, 255, 0); // yellow
newColor := CreateRGB(0, 0, 255); // blue
ImageEnView1.Proc.CastColorRange(oldColor, oldColor, newColor);
// resample to 20x20
ImageEnView1.Proc.Resample(20, 20, rfNearest);
// make all pixels with "transpColor" transparent (alpha=0)
transpColor := CreateRGB(255, 255, 255); // white
ImageEnView1.Proc.SetTransparentColors(transpColor, transpColor, 0);
// now you can save the PNG and reload it
ImageEnView1.IO.SaveToStreamPNG(AStream);
AStream.Position := 0;
APng.LoadFromStream(AStream);
ADatamodule.ImageList.AddPng(APng);
end;
Note that CreateRGB is defined in "imageenproc" unit.
Hope this helps.