Take a look at Sparse Color Gradients...
http://www.imagemagick.org/Usage/canvas/#barycentric
This just takes ANY image, and overwrites it with the gradient specified. Positions of the colors can be set using percent escapes.
However adding 3 colors in a linear line will likely cause a fault, as it technically needs a triangle of points, 2 of whcih may be the same color to specify the angle of the gradient.
However using it to generate the grayscale gradient which is then recolored will make things very versatile, in terms of angles, specified using points.
That means you can generate the 'desired size', and then just use a separate 'sparse color' argument variable to specify the gradient type, and finally recolor it using the appropriate CLUT image. Each step a completely separate step to the others.