This is translated from Mats’s post.
From a geometric optics point of view, the smaller the pinhole diameter of a pinhole camera, the higher the resolution, but considering the diffraction properties of light, when the pinhole diameter decreases, the light diffuses due to the diffraction effects and therefore a pinhole that is too small will reduce the resolution.
This post provides examples of pinhole diameter analysis to maximize the resolution of a pinhole camera.