Hi Nigel,
I am sorry, but: ImageEnView1.LayersMerge( selLayers );
in this case does in fact only merge the selected line-layers among each other and not with the background image:

As the documentation about LayerList says: "...all layers will be merged into the layer specified by the first index". And since the first index of the LayerList integer-array in this case is the index of the first selected line-layer, the layers from the integer-array are being combined among each other and not with the background image.
And even if you start the loop from 0 as in your code example, it will not work because the condition (imgMain.Layers[i].Kind = ielkLine)
does not apply to Layer 0 (the background image).
And even if you explicitly add the background-layer in the integer-list loop with: ( i = 0 ) or ( ImageEnView1.Layers[i].Selected and (ImageEnView1.Layers[i].Kind = ielkLine))
it will just combine the background-layer with itself if there are no line-layers selected.