Photographic cameras were a development of the camera obscura, a device possibly dating back to the ancient Chinese and ancient Greeks,which uses a pinhole or lens to project an image of the scene outside upside-down onto a viewing surface.
An Arab physicist, Ibn al-Haytham, published his Book of Optics in 1021 AD. He created the first pinhole camera after observing how light traveled through a window shutter. Ibn al-Haytham realized that smaller holes would create sharper images. Ibn al-Haytham is also credited with inventing the first camera obscura.
On 24 January 1544 mathematician and instrument maker Reiners Gemma Frisius of Leuven University used one to watch a solar eclipse, publishing a diagram of his method in De Radio Astronimica et Geometrico in the following year. In 1558 Giovanni Batista della Porta was the first to recommend the method as an aid to drawing
Before the invention of photographic processes there was no way to preserve the images produced by these cameras apart from manually tracing them. The earliest cameras were room-sized, with space for one or more people inside; these gradually evolved into more and more compact models such as that by Niépce's time portable handheld cameras suitable for photography were readily available. The first camera that was small and portable enough to be practical for photography was envisioned by Johann Zahn in 1685, though it would be almost 150 years before such an application was possible.