# Is my distance/size math for macro photography correct?

I was comparing Panasonic lenses the other day, and I wanted to know about their macro capabilities. Obviously Panasonic lists the closest focusing distance, but this doesn't tell me much about the image, since focal length is also a factor.

So I came up with this formula for calculating the size of an object, which fills the entire field of view, at a given distance (in this case the minimum focus distance).

Size = 2 ⋅ tan(FOV/2) ⋅ distance from camera

to see how I came to this formula, see the image below.

When plugging in the numbers from some lenses I came to these results:

Is the formula correct? Does this mean, if I take a picture with the first lens, I could have an object with a size of 0.076m fill the entire image?

Is the formula correct? Does this mean, if I take a picture with the first lens, I could have an object with a size of 0.076m fill the entire image?

No. Not quite. Echoing Olin's answer, you have to determine the effective focal length (EFL) to calculate angle of view (or given AoV, to calculate in-focus subject plane dimensions). For stated focal length F, magnification ratio m, the EFL ƒ is given by:

ƒ = F∙(1 + m)

Normally, angle of view is calculated based on the geometry of the camera and lens, using the dimensions of the sensor/film, and the lens's focal length. So rather than subject plane dimensions and distance-to-subject, angle of view is given by:

𝛼 = 2 tan-1(d / 2ƒ)

where d is the dimension of interest of the sensor (i.e., sensor height for vertical angle of view, sensor width for horizontal angle of view, or sensor diagonal for diagonal angle of view (the minimum image circle the lens must cover without vignetting)).

In your examples, rather than calculating angles of view, you were using angles of view given by the manufacturer. Unfortunately, in the case of the macro lens, the manufacturer's stated 40° diagonal angle of view doesn't state the focus distance; most likely, that is the angle of view when the lens is focused to infinity (which is the condition where focal length is defined, at least when using the thin-lens formula).

Assuming the given 40° angle of view is for non-macro distances, then you need to incorporate the effective focal length when calculating angle of view at macro distances.

Given an EFL of ƒ = 2 F (from Panasonic's site, "Maximum magnification = Approx. 1.0x"), then your closest-focus angle of view is more like 20.4°.

• So would the formula be "Size = 2 ⋅ tan( 2 ∙ atan(d / 2 ∙ F ∙ (1 + m) ) ) ⋅ distance from camera" in the end? Jun 18, 2017 at 17:40
• Actually, you don't need trigonometry at all if you don't care about the angle. Given sensor dimension d, EFL ƒ, distance to subject s, field of view dimension x (would be height, or width, or diagonal, of what you're taking a picture of) (depending on if d is sensor height, width, or diagonal), then d /ƒ = x / s.
– scottbb
Jun 18, 2017 at 17:44
• Using your labels, my x is your "Size" (2 o), and my s is your a. So at macro focus distances, d / (F ∙ (1 + m)) = 2 ∙ o / a
– scottbb
Jun 18, 2017 at 17:47
• – scottbb
Jun 18, 2017 at 17:50
• – scottbb
Jun 18, 2017 at 17:51

Your geometry is a reasonable approximation for distant scenes. At close scenes, the focal point to image plane distance is significant and must be taken into account.

At 1:1, the focal point 2x the focal length from the image plane and the scene. At higher magnifications, the focal point is closer to the scene than the image plane. You can't ignore this for calculating geometries of macro and near-macro shots.

The data states the diagonal angle of view is 40° for this 40mm. This is true if the lens is mounted on a DX (compact digital). This 40° angle of view is computed based on the diagonal measure of this format. The DX format measures 16mm vertical (height) --- 24mm horizontal (length) – 28.8mm diagonal (corner to corner).

We can use ordinary lens formulas to compute the angle of view realized. Below is the formula you can plug into Excel. A quirk of Excel is it works in radians not degrees. At the end of the formula we plug in the conversion which is *180/PI(). Anyway the math is:

Diagonal angle of view =((ATAN(28.8/2/40)))*180/PI()*2

Vertical angle of view =((ATAN(16/2/40)))*180/PI()*2

Horizontal angle of view =((ATAN(24/2/40)))*180/PI()*2

Answer for 40mm lens 16mm vertical dimension angle of view = 22.6°

Answer for 40mm lens 24mm horizontal dimension angle of view = 33.4°

Answer for 40mm lens 28.8mm diagonal dimension angle of view = 39.7°

OK, the angle of view is computed based on the focal length and one of the three dimensions of the format. Now, keep in mind that the focal length is computed based on the lens imaging an object at infinity ∞. This will be objects about 3000 X the focal length away from the camera thus 40 X 3000 = 120,000mm = 4,724 inches = about 400 feet distant. In other words, the camera lens projects an image of the outside world on the surface of film or digital sensor. The distance lens to image is published as the focal length, and this value is only true if the lens is imaging a distant object.

As you image objects closer than infinity ∞, the distance lens to image increases. At life-size (magnification one also called unity or 1:1) the projection distance is 2X the focal length. In other words at unity, a 40mm lens will project from a distance of 80mm. For a unity setup, the focal length, now called the “back focus” is 80mm. Now we must compute using 80mm. For this setup:

Answer for 80mm lens 16mm vertical dimension angle of view = 11.4°

Answer for 80mm lens 24mm horizontal dimension angle of view = 17.1°

Answer for 80mm lens 28.8mm diagonal dimension angle of view = 20.4°

You can compute the size of the image based on the fact that the image triangle is similar to the object triangle. The length of the base of the object triangle is the distance lens to object. The length of the base of the image triangle is the distance lens to image. All angles are equal and all sides have the same ratio.

Another approach is to calculate the object distance that yields a specific magnification. Suppose, using an DX camera, format 16mm height by 24mm length with a 40mm lens mounted.

Our objective is to copy a document 5 inches by 8 inches and fill the frame to the maximum. We calculate the magnification needed for both height and length, we must use the minimum of these two values otherwise we will get overspill.

The magnification required for the short distance is 16 ÷ 127 = 0.126 written as 0.126X

The magnification required for the long distance is 24 ÷ 203 = 0.1182 written as 0.1182X

We use the lower of the two = 0.1182X

Now the task is to setup a camera to object distance that yields a magnification of 0.1182X

If we use 0.1182 X then the image dimensions of the object will be:

127 X 0.1182 = 15mm

203 X 0.1182 = 24mm.

To achieve, using a 40mm lens, we now calculate object distance.

Formula: m = magnification

f = focal length

p = object distance

m =f ÷ (p –f )

0.1182 = 40 ÷ (p – 40)

p = 378.4mm

Object distance 378.4mm with a 40mm yields the required magnification. The object fills the camera frame.
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0, "url": "https://photo.stackexchange.com/questions/90228/is-my-distance-size-math-for-macro-photography-correct", "fetch_time": 1701634862000000000, "content_mime_type": "text/html", "warc_filename": "crawl-data/CC-MAIN-2023-50/segments/1700679100508.53/warc/CC-MAIN-20231203193127-20231203223127-00775.warc.gz", "warc_record_offset": 538416517, "warc_record_length": 45538, "token_count": 1908, "char_count": 7230, "score": 3.765625, "int_score": 4, "crawl": "CC-MAIN-2023-50", "snapshot_type": "longest", "language": "en", "language_score": 0.9524310231208801, "file_path": "/sailhome/yjruan/project/latent-lm/data/processed/finemath-4plus/finemath-4plus/train-00022-of-00064.parquet"}