I have a single icosphere in my Blender project and I'm using 2.91.0. My active camera has a background image of a few buildings and I have a foreground framing image that's a blue box that fits around the edges of the rendered area and the rest of it is alpha channel, so it can be transparent. The icosphere has a brick texture. This is all just for testing.
Here's the Blender window. I've hit numpad-0 so the view is through my camera:
Note that I have two images specified in the Camera editor on the right, one for foreground, one for background. I've also changed the offset for the background image and, in the Lens section (at the top of that editor - the top part of that section can't be seen), I've set an offset to put the sphere on the point of a small tower on a building.
In the 3D view, you can see the light blue frame I created (that's in the foreground image). The rest of the foreground image is transparent. You can see a bit of the orange camera image outline underneath the blue outline. So the blue should be framing the image when I render it.
Here is the rendered image, using Eevee:
There are a number of differences:
- The frame in the foreground image is missing. (Note Opacity is set to 1.0, so it should be there.)
- The rendered image includes the entire background picture, not just the area framed by the camera (which matches the area I have framed in blue). The foreground image is the same size, in pixels, as the specified image size for rendering (set in the Output Properties editor).
- The sphere has moved to the left and up from the position I set it in when looking through the camera view in the 3D Viewport.
To render, I just went to the menu and picked Render->Render. (I use an iMac which uses the function keys, so I don't use them for individual programs.)
Why are there these significant discrepancies between the rendered image and the camera view in the 3D Viewport?