Solution (source code)

= Solution

Use the <thin lens> equation with positive object and real-image distances $u,v$:
$$
\frac1f=\frac1u+\frac1v,\qquad v=\frac{fu}{u-f}=\frac{(4)(300)}{300-4}\,\mathrm{mm}=4.054\,\mathrm{mm}.
$$
The transverse <magnification> is $M=-v/u=-f/(u-f)=-4/296$. For an object dimension $500\,\mathrm{mm}$, the corresponding image dimension is
$$
\boxed{|h_i|=\frac4{296}(500)\,\mathrm{mm}=6.76\,\mathrm{mm}.}
$$
The minus sign of the <magnification> means that the image is inverted. This is the ideal thin-lens prediction; it assumes the relevant field is admitted by the camera and ignores lens distortion.