How do I anchor sprite positions to an Image with "Preserve Aspect" set?

You can see in the image I have a background image with some trees, and it is set to Preserve Aspect. So even though the screen has been set to a resolution with the wrong aspect ratio for the image, it’s still displaying properly.

The panel it’s on is larger than the image because of this. My problem is that I want the objects in the scene (the bugs) to maintain their location relative to the image, not the panel.

The anchors care about the panel’s size, not the image’s size. Is there a way for me to get this to work?

I’ve tried using an AspectRatioFitter as suggested by one of the answers, and I get this. The blue dots show the size of the fitter is correct, but its anchors are in the same place as the parent RectTransform, which means it doesn’t change the location behavior of the objects.

Give the image a AspectRatioFitter and set it to the aspect ratio of the image (The mode should be FitInParent). This way the actual RectTransform it’s height/width are set to this aspect ratio.