It depends on the type of photo.
If it’s a traditional film photo, then the light enters the lens and then gets focused on the film.
That film has a layer that is a mixture of chemicals that react when exposed to light (which is why film has to be stored in dark rolls and then has to be developed in a dark room). So essentially you’re just exposing those chemicals to just the light you want to capture as the image, and they react forming that image.
Digital cameras work in a similar way, but instead of a chemical reaction, it’s an electronic sensor getting hit by the light that saves the information about the mind of light that is hitting it.
Because light is a form of energy, it can be measured. Think of it like a stream of little balls hitting something that counts them. The number of balls in a specific time frame (wavelength) defines the colour of light.
Our eyes see by little cells that contain photosensitive proteins. When light hits the retina, the proteins only react to specific wavelengths and the brain interprets that to form an image.
With photographic film, the film is coated with photosensitive pigments that react to the wavelengths of light. With a bit of extra chemistry, those patterns are printed onto paper so you can see the image.
With digital sensors, millions of pixels detect light and convert it to information, which is then decoded to display on a screen, or print on paper.
So ultimately, the process is pretty similar. It all relies on the properties of light and light-detection.
Latest Answers