I'm trying to put a displacement map into the alpha channel of a normal map. As per answer to question "Bake displacement to alpha channel" I am trying to use the Node editor for this purpose. The result washes out the colour. I have my problem demonstrated in a test case as follows. I have two (RGB only) images: PaleBlue is coloured (0.5, 0.5, 1.0); DarkGrey is coloured (0.25, 0.25, 0.25). I am trying to combine the colour channels of PaleBlue with the red from DarkGrey as alpha. The screen shot shows my results. On the left are the two input images (RGB only). In the middle is my node structure - a bit more complex than needed, but I think this explicitly shows what I want done. On the right are two views of the output - actually the Viewer Node, but the Render Result is the same. The top view is the colour component, the bottom the alpha channel. Note that the colour is white - not pale blue and that the alpha channel is black. First screen shot removed to be within link limit.
I'm answering this myself - but thanks to @RickRiggs who gave me lots of advice and ideas on the way. There were many issues. It turned out that part of the issue was alpha pre-multiply (aaarrrggghhh - whoever thought of that idea). I found it very hard to tell when and if it might apply, but putting in an Alpha Convert node with setting "Straight to Premultiply" definitely prevented it, despite the fact that its wording kind of suggests the opposite - bit of a theme begins here (maybe its because I am in the Southern Hemisphere and see things the other way up) - possibly the node marks the image as having been premultiplied and therefore prevents it? At that stage putting a constant value in as alpha to the CombineRGBA node worked - the value ended up in the alpha channel of the finished image without changing any of the colours. Unfortunately connecting the Red channel from the Displacement Map image caused colour damage to recur. I tracked this down (I think) to the fact that the Displacement map was in sRGB. When I changed it to 'Non Color' and regenerated, everything worked. Maybe I should have thought of it, but it was fortunate that I didn't. It is important that the Normal Map is in sRGB space, else pre-multiply occurs again. The only other unexpected feature was that baking the displacement map gave displacements in the range 0 to 0.5, hence the Math node to double displacement values. The only other thing that gave me persistent problems was the fact that it the displacement map 'Normalizes' rather more when the Normalize switch is turned off - maybe that's a Southern Hemisphere view again. Finally Rick - connecting the alpha input to the Viewer and Composite nodes causes trouble now that I have the Alpha Convert in place, so I removed those connections.
What you do looks fine but you have to be careful with math node. If you don't check "clamp", you'll get alpha values greater than 1. It can be a problem or not, but you have to know it.
If you want fine control, you can use a color ramp to find the position where you want full white and full black (or anything else).
You can use the node "set alpha" to make things easier.