Hi Jurgen
Still not following you. I’ll make a recommendation –
You’ve provided what looks like two distinct images – one over another; one smaller than the other.
Now for the Qs –
1) What is your desired output size, relative to what you have provided?
1A) Is it bigger/smaller than the larger/smaller image?
1B) or is it the same as one of the TWO images shown?
Without waiting for you answers, may I suggest that you try to apply by double-clicking the QuickMask Tool while the layer that you want to apply a border to is selected. Then apply EffectGenerate->Stroke, and changing the Width parameter to suit your needs.
Another option, which is to enlarge the size of your inner image, is to apply MotionTile to the inner/smaller layer and increasing the Output Width and Output Height settings to suit your needs.
HTH
Roland Kahlenberg
https://www.broadcastGEMs.com – Adobe After Effects project files
https://www.myspace.com/rorkrgbspace