# How to calculate the optimal pinhole size?

As far as I've understood, optimal diameter for pinhole size is calculated by formula where

d - the optimal diameter for pinhole
c - constant
f - focal length (distance between pinhole and film/sensor)
λ - wavelength of light the pinhole should be optimized for

f and λ should be in same units as desired for d

Different sources seem to agree that about 550nm (green-yellow) is a good value for λ, and the focal length part is also quite clear.

However, each source seems to provide different value for the magic constant c

The difference of 34% between smallest and largest suggested value seems quite significant.

Why are there so many different values for the constant? Are different constant values optimizing different properties of resulting image? Or perhaps different constants apply to different pinhole material thicknesses (if that's the case, do bigger constants go for thicker materials)?

• I'm struggling to figure out how the value of d relates to the pinhole size. I had an answer (based on c=1.414, f=50mm) of 234? if this is mm thats a bit big! if thats nm thats far too small... Should all figures be in nm, mm, etc?? Jan 3 '14 at 9:50
• All figures should be in same units as you want the result in (mm seems to be most common; 550 nm = 0.00055 mm)
– Imre
Jan 3 '14 at 10:46
• As far as I'm aware - differences between these will be rather insignificant in exposure (you'll learn them after few exposures and than just apply your own exposure compensation to balance out exposure exactly as you like it) - it's much more important to get a perfectly round pinhole, than whatever it's 34% bigger or smaller. Jan 3 '14 at 10:48
• There is no optimum value for the size of the pinhole as it depends on the relevant importance to you of: peak sharpness, average sharpness, light sensitivity, as well as the type of scene you are photographing. Jan 3 '14 at 11:33
• @MattGrum if you could describe how increasing/decreasing hole size affects those properties, that'd be awesome (and also an answer to what I'm asking here)
– Imre
Jan 3 '14 at 11:47

I can't summarize the whole optical physics theory behind pinhole (mostly because I don't have the proper knowledge!), but I try to explain why there are different values for constant `C`. One reason that there are different values for `C` is the fact that one parameter in the calculation of optimum diameter of hole is missing! Let us refer to the wikipedia article that you mentioned:

Within limits, a smaller pinhole (with a thinner surface that the hole goes through) will result in sharper image resolution because the projected circle of confusion at the image plane is practically the same size as the pinhole. An extremely small hole, however, can produce significant diffraction effects and a less clear image due to the wave properties of light.

This means `the purpose of C is to find a value that results in good trade off between sharpness and diffraction`. Determining this value, however, is dependant on another factor and that is the distance of the subject to the camera. Circles on the bottom shows the effect of pinhole size on the resulting image. In the second figure dashed line (geometric limit) is the resolution and solid line is the diffraction. As you can see the diffraction is affected by `θ` which is a function of distance to the pinhole.

With all being said, IMHO, the whole reason behind different values for `C` is the fact that it is obtained empirically and each of them had a different value for `p` (with reference to the first figure).

The plots are borrowed from this file. You can find a lot about the pinhole physics in this document.

P.S. I had a look at the source of the `mrpinhole.com` page and it seems they are using `C=1.92`.

P.P.S. Having a look at those websites, it seems each of them have a different value for `λ` and this could lead to different value for `C`.

P.P.P.S. I agree with MarcinWolny's comment that a perfectly rounded hole is way much more important.

The earliest investigation of the right constant c that I am aware of is Petzval's 1859 On the camera obscura. The paper is predominantly about a new lens design he has created but he begins with an investigation of the optimum radius of a pinhole for resolution of the image. Resolution is defined as the ability to discern the difference of two very close objects in the image. If we imagine the objects as point-sources of light then we will be able to resolve that there are two if the spots of light they cast in the image do not substantially overlap. Thus to determine the resolving power of a pinhole we need to determine the diameter of the image of a point-source of light. If the pinhole is big then classical optics say the size of the image is the same as the size of the pinhole. If the pinhole is small diffraction causes the image of a point-source of light through a pinhole to consist of a brighter central spot surrounded by a series of concentric dark and light rings. Petzval creates a equation for the diameter, D, of the largest, central spot of light in cast through a pinhole which attempts to take into account both the classical optics ("large" pinholes) and diffraction ("small" pinholes):

D = 2r + fλ/r

where r is radius of pinhole, f is focal length and λ is wavelength of light. Using elementary calculus he finds that the diameter of light is minimized when

r = sqrt{fλ/2}

or

D = sqrt{2} sqrt{fλ} = 1.414 sqrt{fλ}.

In 1891 Lord Rayleigh published his first On pin-hole photography(p. 493) where he proposes

D = sqrt{2} sqrt{fλ}

based on the computation that with such a pinhole size the maximum phase difference between any two rays of light is no more than λ/4 and thus cannot substantially interfere destructively. He posits this as a good rough criterion for the perceived diameter of the image of a point source of light through a pinhole. He discussed having demonstrated by experiment that this value is good in practice.

In 1891 Lord Rayleigh published his second On pin-hole photography In this paper he criticizes Petzval's argument for being unsound but notes that it gives the same value that was determined by rough calculation and experimentally in his previous paper. Then, using Lemmel's exact solution to the computation of the diffraction image of a point-source of light through small apertures, he computes the shape of the diffraction patterns formed by small circular pinholes. He then calculates the size of the central dot for c = 1, sqrt{2}, 2, sqrt{6} and 2 sqrt{2}. He notes that the two cases that have the smallest diameter of central image spot are c = sqrt{2} and c=2.

He then describes an experiment done with a range of actual pinholes and determines that the best was equivalent to c = 1.89 which falls in the zone he determined from theory. The sizes of pinholes he tried that were smaller and larger than his experimentally chosen best one were equivalent to c = 1.74 and 2.11 so his value of c should be considered good to within about 10%. Before moving on let me recommend the web page Pinhole Design – what Lord Rayleigh really said for a discussion of Lord Rayleigh's other results from this paper, in particular the fact that there is an f-stop number past which lenses are not better than pinholes. They also discuss the implications for what will be in focus for pinhole cameras (it is not the whole field).

In 1971 Young performed a series of experiments with very fine differences in constant c which he reported in Pinhole Optics. He determines that the value of c which optimizes resolution is c=2. These results are probably good to about 1% which is quite precise.

In a 2004 presentation The Pinhole Camera Revisited or The Revenge of the Simple-Minded Engineer Carlsson points out however that that resolution is not the only factor that affects how sharp we perceive an image to be. Another important factor is the Contrast. Optimum contrast is determined not by the smallest radius of the central spot in the diffraction patter through a pinhole, but how much of the total light is contained in the central bright spot, in other words, how concentrated the light it around the center. He provides some very good pictures demonstrating the difference between resolution vs. contrast and to my eye he is correct that sacrificing resolution for increased contrast improves the image. His value of c which optimizes contrast is c = 1.56. The closest other values of c that he reports are c=1 and c=2 so c=1.56 should be considered good to within about 20%.

Trying to find a higher precision result for the best constant for contrast led me to Sroyon's Making, Measuring and Testing the “Optimal” Pinhole: Pinhole Adventures Part 3 which presents some good discussion and experimental results. His article led me to two more references which discuss the resolution/contrast tradeoff which follow.

In 2017 Tim Parkin reported a series of pinhole tests for resolution and contrast in The Science and Aesthetics of the Hole which also has some good photos showing difference between the two criteria. He used homemade and laboratory made pinholes and it is nice to see the impact of thinness of material and quality of the hole on the resulting pictures. His tests also verify that for human perception of sharpness c=1.56 is the best. Parkin varied his focal length for a set of four pinhole sizes but it is not clear to me what precision applies to his findings that c=1.56 is best.

Finally a similar discussion appears in Lambrecht & Woodhouse's Way Beyond Monochrome on pp.153-154, where c=1.56 is given as the best compromise. The authors use the word "Theorem" but do not give the proof that 1.56 is optimal. I would like to have a reference for this proof but I have not found one yet. In this text they claim that the optimum resolution is given by c=1.9 citing Lord Rayleigh but to me Young's empirical evidence for c=2 seems quite strong.

I think the take away from all this is that c=2 seems to be well supported by experiment and theory for maximizing resolution (being able to discern the difference between two close objects) but for images which appear "sharp" to human eyes, contrast is important too and thus one should use a smaller value of c, perhaps as low as c=1.56. In the cases above where actual photographs were taken and shown, the perceptual differences between c=1.56 and c=2 are very subtle so my last take away is not to worry too much about where you are in this range.

• Reading the summary of Carlsson reminded my of a very long time ago when I used to work in the paper industry. One of the measurements of defects in white paper was called "visual impact", which was in effect a measurement of the local contrast of an inclusion. So a bigger, but less dark inclusion was less bad than a smaller but much darker inclusion. Jan 9 at 14:45
• That makes sense @peter-m Jan 9 at 15:01