system
Given the following post, respond as if you're commenting on Reddit:
human
eli5: How exactly do photographs work?

How can you freeze an image of reality onto a tangible surface?
gpt
There are certain chemicals that are sensitive to light. When exposed to light they change colors (specifically get darker). 

To make a picture with film, you first have transparent plastic that is coated with a chemical that burns depending on how much light hits it. When you expose that film to light for a fraction of a second the parts that were brighter in the image turn darker on the film. And the parts of the image that are darker reflect less light and so the film remains more transparent. 

You then process that film thru chemicals that freeze the light reacting chemicals and prevent them from continuing to react. Now you have a sheet of semi transparent film that is an inverted image of the image you wanted to capture. 

If you project light thru that film. You can project it onto a sheet of paper that is coated with similar chemicals that react to light (the parts exposed to more light will darken more). If you do this for a few seconds and then use chemicals to freeze the light reacting chemicals again then you will get an image that is an inverse of the inverse of the original image, in other words it looks like the image you took.

This explanation implies a black and white photo. But color film works similarly it just has has chemical that react to different colors of light when they darken. 

Digital cameras are kinda similar. The lens, shutter, and aperture can all work the same as film except instead of projecting the image onto a sheet of film it projects it onto a square of a bunch of light sensors in a grid. Each sensor measures exactly how much light hit that spot and records it on a defined scale, for this example from a range from 0 to 255. 0 if it saw no light at all, 255 if it saw the maximum amount of light it is able to measure. For most cameras, each pixel has a filter on it that only allows it to see either blue, red or green light. When you group the data from 3 (or usually 4 with an extra green) pixels that are all right next to each other you can get a value for that tiny square of the image that is recorded like: red = 200, green = 40, blue = 220, which would be a pixel that is a shade of purple.

And when you add all of the millions of light sensors’ data to gather you can get a list of what every dot in the grid (a pixel). Some image file formats are literally a list from left to right for each row of pixels of how much light each recorded. So when a display needs to show the image it just shows a light with that color hue at that brightness in the location that the sensor recorded it.