How a Camera Works, From Pinhole to Sensor

Parts of a taken-apart film camera laid out in neat rows on a white surface, including the lens, shutter and body pieces
Photo by Shane Aldendorff on Unsplash. A camera taken apart shows the separate pieces the page describes, such as the lens, shutter mechanism and body.

A camera is a lightproof box with a hole at the front and something light-sensitive at the back. A lens bends incoming light into a sharp image, an adjustable opening called the aperture limits how much gets through, a shutter decides for how long, and film or a digital sensor records the result. Everything else on a camera, from autofocus to the viewfinder, helps you aim, focus and time that one moment.

The idea underneath every camera: a dark box and a small hole

Long before anyone could record a picture, people noticed that a small hole in the wall of a dark room projects an upside down image of the scene outside onto the opposite wall. This is the camera obscura, Latin for “dark room”, and every camera since is a refinement of it. Light travels in straight lines, so rays from the top of the scene pass through the hole and land low on the wall, and left and right swap the same way.

The hole creates a trade-off that every camera still lives with:

  • A smaller hole gives a sharper image, because each point in the scene makes a smaller spot on the back wall. But it lets in very little light, so the image is dim.
  • A bigger hole gives a brighter image, but each point spreads into a larger blur, and the spots overlap into mush.
  • Too small a hole blurs again, because light spreads out as it passes a very narrow opening. This is diffraction in photography, and it is why there is a best pinhole size for any box depth.

You can still make pictures this way. Pinhole photography uses a box with a tiny hole and no lens at all, and the exposures run from seconds to minutes because the opening is so small. The whole history of the camera, told in the evolution of photography from daguerreotypes to digital, is largely the story of escaping that trade-off: getting a bright image and a sharp one at the same time.

Follow one press of the shutter

  1. Light leaves the scene and enters the lens, which bends it into a focused image.
  2. The aperture inside the lens limits how wide the beam can be.
  3. A viewing system (a mirror and prism, or the sensor itself feeding a screen) shows you the image before you take it.
  4. Autofocus and the light meter measure the scene when you half-press the button.
  5. The shutter opens for a set time and closes again.
  6. The film or sensor records the light that arrived during that time.
  7. On a digital camera, a processor turns the sensor’s readings into a picture file.

Step 1: the lens bends light into a sharp image

A lens solves the pinhole’s problem. Instead of letting only a thin pencil of rays through, it accepts a wide cone of light from each point in the scene and bends all of those rays so they meet again at a single point behind the lens. A big opening and a sharp image at the same time: that is the entire reason lenses exist.

The bending is called refraction. Light slows down in glass, and when it enters or leaves a curved surface at an angle it changes direction. A convex surface, thicker in the middle than at the edges, brings rays together. The image a lens forms is still upside down and reversed, exactly like the camera obscura’s.

Three things to understand about the lens as part of the machine:

  • Focal length sets how big the image is. A longer focal length forms a larger image of a distant subject, so less of the scene fits on the sensor. A shorter one forms a smaller image and takes in more. Focal length has its own page with the numbers.
  • Focusing moves the lens relative to the sensor. Light from a near subject comes together further behind the lens than light from a far one, so to focus closer, the lens (or a group of glass inside it) moves forward. Turning a focus ring or letting the motor drive it does exactly this. Only one distance is perfectly sharp at a time; the range that looks sharp enough is the depth of field.
  • Real lenses use many pieces of glass. A single curved lens bends different colours by slightly different amounts and blurs the edges of the frame. Camera lenses combine several lens elements so their errors cancel. How that works is in understanding lens optics.

Step 2: the aperture limits the light

Inside the lens sits a ring of thin overlapping blades, the iris diaphragm, that can open wide or close down to a small hole. This adjustable opening is the aperture. It does for a lens what the size of the hole did for the camera obscura, except now the lens keeps the image sharp at every setting.

Aperture is written as an f-number, which is the focal length divided by the diameter of the opening. A 50mm lens at f/2 has an opening 25mm across; at f/8 the opening is 6.25mm across. Each step in the standard sequence (f/2, f/2.8, f/4, f/5.6, f/8) halves the area of the opening and so halves the light; that is one f-stop.

Aperture changes two things at once: how bright the image is and how much of the scene is in focus. A wide aperture such as f/2 gives shallow depth of field; a narrow one such as f/11 gives deep focus. For how to choose, see what aperture is and how it affects your photos.

Step 3: how you see the image before you take it

The film or sensor sits at the back of the box behind a closed shutter, so a camera needs some other way to show you what the lens sees. There are three main answers, and they are the real mechanical difference between camera types.

The mirror and prism

In a single lens reflex camera, a mirror angled at 45 degrees sits behind the lens and reflects the image up onto a focusing screen. A five-sided prism (or a set of mirrors) above the screen flips the image the right way up and right way round and sends it to the eyepiece. You see through the actual lens, optically, with no delay. When you press the shutter, the mirror swings up out of the way so light can reach the shutter and sensor behind it, then drops back. The viewfinder goes dark for that moment. The DSLR page covers this design in more detail.

The sensor and an electronic screen

A mirrorless camera has no mirror. Light from the lens falls straight on the sensor, which reads the image continuously and shows it on the rear screen or a small electronic viewfinder. You see a preview of the actual exposure, including brightness and white balance, at the cost of a tiny delay and some battery drain. Phones work the same way. The trade-offs are set out in optical versus electronic viewfinders.

Step 4: the half-press, focus and metering

Pressing the shutter button halfway wakes up two measuring systems before any picture is taken.

  • Autofocus measures whether the subject is sharp and drives the focusing motor in the lens until it is. Some systems compare two views of the subject through the lens to work out which way and how far to move; others nudge focus back and forth until contrast peaks. How autofocus works explains both.
  • The light meter measures how bright the scene is and works out an aperture, shutter speed and sensitivity that will record it at a middle brightness. The camera can measure the whole frame, the centre or a small spot. Metering covers the modes and why a meter can be fooled by a white or black scene.

The full press then starts the exposure. The short pause some cameras have between the press and the picture is shutter lag, and half-pressing first removes most of it, because focusing and metering are already done.

Step 5: the shutter times the light

The shutter is a gate that keeps the sensor dark until the moment of exposure, opens for a precise time, and closes. That time is the shutter speed, written in seconds or fractions of a second: 1/1000, 1/125, 1/2, 2 seconds. Each doubling of the time doubles the light, so 1/125 to 1/250 is one stop, the same size of step as one f-stop. For freezing and blurring motion, see shutter speed.

The focal plane shutter

Most interchangeable lens cameras use a focal plane shutter: two curtains just in front of the sensor. The first curtain moves away to uncover the sensor, and after the set time a second curtain follows to cover it again. At slow speeds the whole sensor is uncovered at once. At fast speeds the second curtain starts before the first has finished, so a narrow slit travels across the sensor and every part gets the same brief exposure, just not at exactly the same instant. This is why flash, which lasts a tiny fraction of a second, only lights the whole frame up to a top speed called the flash sync speed.

The electronic shutter

A digital sensor can also time the exposure itself by switching on, collecting light and being read out, with no moving curtain at all. Most sensors are read one row at a time, top to bottom, which can bend fast-moving subjects; that is rolling shutter. A global shutter reads every pixel at once and avoids it. The practical differences are in mechanical versus electronic shutter.

Step 6: film or a sensor records the light

Everything so far has been about delivering the right amount of focused light to one flat surface, the focal plane. What sits there decides whether the camera is a film camera or a digital one. The rest of the machine is nearly the same.

Film

Film is a plastic strip coated with tiny crystals of silver halide held in gelatin. When light hits a crystal it changes a few atoms, leaving an invisible mark called a latent image. Developing the film in chemicals turns the marked crystals into black metallic silver, and fixing washes away the unmarked ones. The result is a negative: bright parts of the scene are dark on the film. After each frame the film is wound on so fresh film sits behind the shutter. Film photography covers using it today.

A digital sensor

A sensor is a grid of millions of light-sensitive sites. Each one converts arriving light into an electrical charge in proportion to how much light hit it during the exposure. After the shutter closes, the camera reads each site’s charge and converts it into a number. How image sensors work goes through this in depth.

Each site measures only brightness, not colour. To capture colour, most sensors place a mosaic of red, green and blue filters over the grid, one colour per site. In the usual Bayer filter pattern, half the sites are green, a quarter red and a quarter blue, because our eyes are most sensitive to green. Every pixel in the final picture needs all three colours, so the camera estimates the two missing ones from the neighbours. That step is demosaicing.

The sensor’s sensitivity setting, ISO, does not make the sensor collect more light. It sets how much the signal is amplified after capture, which is why high ISO brightens the picture and also brightens the noise.

Step 7: the processor makes a picture

A digital camera’s job is not finished when the shutter closes. A processor reads the sensor data and either saves it almost untouched as a raw file or builds a finished picture: it demosaics, sets white balance, applies contrast and colour, reduces noise, sharpens and compresses the result into a JPEG. Which of those you want the camera to decide for you is the subject of raw versus JPEG.

How the parts work together as one exposure

Three of the parts above set the brightness of the picture: the aperture controls how much light arrives per moment, the shutter controls for how long, and ISO controls how strongly the result is amplified. Each is measured in stops, so a stop taken from one can be given back by another. Opening from f/8 to f/5.6 and shortening the shutter from 1/125 to 1/250 gives the same exposure, because one stop more light per moment for half the time cancels out. That balance is the exposure triangle, and the Camera Simulator lets you move all three and see the effect.

Common mistakes in how people picture a camera

  • Thinking the lens “takes” the picture. The lens only forms an image. Nothing is recorded until the shutter opens and the film or sensor collects light, which is why the most perfectly focused lens still gives a black frame if the shutter never lets light through.
  • Thinking a bigger f-number means a bigger opening. It is a fraction. f/16 means the opening is one sixteenth of the focal length, so it is smaller than f/4.
  • Thinking each pixel records full colour. Each sensor site records one colour behind a filter. Two thirds of the colour information in a finished pixel is estimated from its neighbours.

Try this: watch your own camera work

This takes about ten minutes and shows the aperture, shutter and sensor doing their jobs.

  1. Watch the aperture close. With an interchangeable lens camera in manual mode, set f/16 and a shutter speed of 1 second. Point the camera at a bright window, look into the front of the lens from a little to one side and press the shutter. You will see the iris blades snap down to a small hole for the exposure, then open again.
  2. Watch the shutter time the light. Find something with steady motion, such as a ceiling fan or running tap. Take one picture at 1/1000 and one at 1/15, letting the camera adjust ISO to keep the brightness similar (auto ISO in manual mode does this). On a phone, use a manual or pro mode if it has one.
  3. Cover the lens. Put your hand over the lens and take a picture. You get a dark frame: no light reached the sensor, so nothing was recorded.

How to judge the result: in the fan pictures, the 1/1000 frame should show the blades crisp and the 1/15 frame should show a smooth blur. If both look the same, check the shutter speed actually changed. In the aperture test, if you saw no blades move, your camera may already close the aperture to your setting for its live view; set f/16, then switch to f/2.8 or the widest setting and watch the blades move as you turn the dial. The dark frame is the whole camera in one picture: everything depends on light reaching the back of the box.

FAQ

Why is the image inside a camera upside down?

Light travels in straight lines, so rays from the top of the scene pass through the lens and land at the bottom of the sensor, and left and right swap too. A mirror camera’s prism flips the view for your eye, and a digital camera simply reads the sensor in the right order.

Do film and digital cameras work the same way?

Up to the moment light reaches the back of the camera, yes: lens, aperture, shutter and focusing work the same. The difference is the recording surface, chemical crystals that are developed later or an electronic sensor that is read out at once and processed into a file.

How does a phone camera differ from a larger camera?

It has the same parts in miniature: a lens, a fixed or limited aperture, an electronic shutter and a small sensor. Because the sensor is small and collects less light, phones lean much harder on processing, often merging several frames to reduce noise and extend the range of tones.

Can a camera work without a lens?

Yes. A small enough hole forms an image on its own, which is how a pinhole camera works. The image is softer and much dimmer, so exposures run long.

Want to see what the sensor does with light at the level of each pixel? Read how image sensors work.

Curious how the camera decides where to focus before you take the picture? See how autofocus works.

Trying to decide between a mirror camera and one without? Start with the difference between DSLR, mirrorless and point and shoot cameras.

Want to build a camera with no lens at all? Try pinhole photography.

Ready to balance aperture, shutter speed and ISO yourself? Work through the exposure triangle.