Chinese texts from the fifth century BC were the earliest records of the principal of the pin hole camera. Chinese writers had experimented with light and discovered it travels in straight lines. The philosopher Mo Ti (later Mo Tsu) was the first to record this formation of an inverted image with the pinhole or screen. Mo Ti was found that objects reflected light in lots of different directions, and that rays from the top of an object, when passed through a pin hole, will re create the lower part of an image. This was the first and last reference to the pin hole camera technique in Chinese texts until the 9th century AD, when Tuan Chheng Shih speaks of an image in a pagoda. He later corrected his explanation of what he meant and the image created. Yu Chao-Lung in the 10th century would make pinhole images on a screen using model pagodas.
Over in the west, Aristotle (4th C BC) writes about a pinhole image formation in his work Problems. Aristotle questinoned the process of the sun passing through quadri-laterals, like intricate weaved baskets, the figure produced was still circular and not rectangular as he had assumed. He also questioned the light in an eclipse of the sun, the rays come through in a crescent shape he related these phenomenons to the light shining through a small rectangular peep-hole but still comes throguh circular in the form of a cone. Aristotle had no answers to his observations; and the mystery remained unresolved until the 16th century
Ibn al-Haytham an Arabian physicist and mathematician , aka Alhazen, experimented with light and image formation in the 10th century AD. He arranged 3 candles in a row then put a screen with a small hole in between the candles light and the wall. He saw that images were formed using these small holes and that the image was inverted ie the candle on the right made an image on the left side on the wall.
In the Centuries that followed these revelations the pinhole technique was often used by optical scientists in experiments to study sunlight projected from small apertures.