This code, which is similar to my original, works perfectly. Thank you for your help.
If I comment out the aJPG.Assign(CardBMP) line, it does not work. This seems especially strange to me because the aJPG image is not being assigned to BMP. Just the process of assigning the JPG image seems to be necessary. Weird!
Unlike the fading approach you used, I prefer
replacing the almost white pixels with the light red. This approach leaves all the non white colors, yellows and other colors, still as vibrant as before.
I tried PRGBTriple, also changing the colors to rgb
Tred, etc. but to no success.
procedure ColorHilite;
const
delta = 50; // from trial and error
maxd = 255 - delta;
var
Row: PRGBQuad;
x, y: integer;
R, G, B: integer;
begin
aJPG.Assign(CardBMP); // unknown why this is necessary
BMP.Assign((CardBMP); // weird, aJPG is not being assigned
R := GetRValue(HiliteColor);
G := GetGValue(HiliteColor);
B := GetBValue(HiliteColor);
BMP.BeginUpdate;
for y := 0 to BMP.Height - 1 do
begin
Row := BMP.ScanLine[Y];
for X := 0 to (BMP.Width - 1) do
begin
if (Row^.rgbRed > MaxD) and (Row^.rgbGreen > MaxD) and
(Row^.rgbBlue > MaxD) then
begin
Row^.rgbRed := R;
Row^.rgbGreen := G;
Row^.rgbBlue := B;
end;
Inc(Row);
end; // for X
end; // for Y
BMP.EndUpdate;
CardBMP.Assign(BMP);
end; // ColorHilite