In rP21113, line 68 makes to pick the red channel instead of the colour channel with highest value as intended by comment and code on line 67
(The facts that heightmaps are grayscaled images { every pixel has all 3 colour channel values identical } and that it is working until now could be enough to be sure this is not going to beak current map generation)
(I think if inlined it would not look good and be harder to understand what is going on there)