The pinhole camera works on the principle of the rectilinear propagation of light. This principle states that light travels in straight lines. When light passes through the tiny hole in a pinhole camera, it forms an inverted image on the opposite side of the camera. The size of the image depends on the distance between the object and the pinhole.