Friday, March 25, 2016

Curiosity Challenge: How does a digital camera take and save photos?

“I am curious how pictures are taken and saved.”  --Jameson Gannon, 14

It’s hard to imagine a world without digital cameras.  While some die-hard photographers still insist that old-fashioned chemically-reactive film produces better photographs, it’s hard to argue against digital cameras’ ease of use and convenience.  Turning that gorgeous sunset or that sumptuous-looking meal that your eyes see into a picture file to share with your friends?  It’s a pretty remarkable feat!  It also takes more steps than you’d expect.

Your Selfie is Made of Electrons

To break this process down, let’s think about what makes an “image” to begin with.  

Grass is green because it reflects the
green wavelength of light.  Via
Visible light waves are hitting objects, the object’s electrons are absorbing some light frequencies and reflecting others, and these reflected light waves are interpreted by our eyes (or our cameras) as different colors based on their frequencies and energy levels.  (Light energy is an entire area of physics on its own, called optics.)  By receiving and interpreting many, many of these color signals, we get the whole picture.  These light waves can have many, many energy levels--they’re analog signals.  To speak the language of computers--binary code made up of 1’s and 0’s--these analog energy values must be converted into digital signals.  That’s basically a digital camera’s job.

To put together a picture, you need not just all these color signals, but the location of each of these colors.  Digital cameras keep the locations of each color straight by splitting the picture into pixels--colored dots that can be easily represented in binary code.  You might have heard someone discussing the quality of a camera in terms of resolution, or how many pixels it splits the image into.  A high-resolution camera will record data for many pixels, making the image sharper, the colors richer, and the size easier to change without pixilation or distortion.  A low-res camera will be grainier, but with less information to convey, its photos will be a smaller file size.  One isn’t necessarily better than the other for every application, but when buying a camera it’s better to err on the side of higher resolution, since you can always compress a picture file to make it smaller (more on that later).  The average cell phone camera these days has around 8 megapixels of resolution, meaning it can record a grid of around 8 million pixels!

An image taken with high resolution, medium resolution, and low resolution.
Which one would you want to use? Via Wikipedia.
How does a camera “see” color?

A silicon chip, called a "charge-coupled device"
CCD) in the business.  Via
Each one of these pixels of the photo has a corresponding photosite on a silicon chip within the camera.  Think of each of these photosites as a mini solar panel: when light from the image hits the photosite, electrons are excited and a tiny charge is conveyed.  However, the photosite is technically colorblind, only able to detect roughly how bright is the incoming light, not really the frequency (color) of that light.  To pick up how much of each color is coming in, a special filter is set in front of each photosite (most cameras use the Bayer filter pattern.  If you like reading about decoding and algorithms, look into it!  It’s really neat!).  Much like how you can make any color of paint from a few primary colors, any color of the rainbow can be made out of the three primary colors our eyes detect: red, green, and blue.  By filtering out the red, green, and blue light frequencies and determining how bright each one is, you can later reconstruct the pixel.  Reconstruct each pixel in the right spot, and you can reconstruct the photo!
Any photo can be split into red, green, and
blue components.  Via

But wait!  These charges are still analog signals, whereas a computer can only understand digital signals.   So an analog-to-digital converter, made of tiny transistors, steps in to do the job.  Taking the amount of charge conveyed after each filter, it supplies four numbers describing each pixel, all in binary code: the pixel’s location in the grid, the brightness of the red component, the brightness of the green, and the brightness of the blue.  The color that’s the brightest across all three colors is white (you’ve encountered this if you’ve ever worked with #ffffff, or white’s hex-color on the web).

Saving and Compression

This picture is compressed heavily on the left side,
but not as much on the right.  Notice the difference?
Via Wikipedia.
Okay, now our picture is represented by four numbers for every pixel, all neatly translated into binary code.  Now what?  Now you can save that information as a file, usually on a rewritable storage device in your camera.  Since four numbers per 8 million pixels is a LOT of information, most digital camera programs compress that data into a smaller, more manageable file, often with the file extension .jpg (pronounced “J-Peg.”  Named for the Joint Photographic Experts Group, which developed this compression format).  Compression takes advantage of two properties that most photos have: repetition and irrelevance.  If half of your picture is made up of a solid blue sky, for instance, the file doesn’t have to repeat that repeated number for every location: it can say “this block of the photo is all this specific color of blue.”  Also, details are sometimes so small that the human eye can’t detect them, so compression also just drops these irrelevant details.  You can also opt not to compress your photos, which usually means your file is saved with the file extension .tif (pronounced “tiff,” which stands for “tagged image file format”), or another file format that follows different compression rules.  Keep in mind that, just like with your original camera resolution, the less data in your final file, the less sharp your image might be.

Finally, you can take that saved file on your camera’s card or storage device, upload it to your computer, and share it with the world!  Some digital cameras and most smartphones can upload these files through wifi, without even needing a physical storage device for the transfer. It’s all thanks to the hard work done by your camera to translate a bunch of stray electrons into 1’s and 0’s, and then into the pixels that make up your photos!

Learn More!

To learn more about the technology behind photo taking and editing, check out the following online resources!

You can also get electrified by light and circuitry at the following events at the Cambridge Science Festival:

  • Lightbox Navigations at the Harvard Art Museum, April 15 - 24, 12:30 PM - 1:00 PM.   See how museum conservationists preserve artwork from the harmful effects of light--and how they're digitizing their collection!  Free!
  • Paper Circuits in the MIT Museum Idea Hub, Saturday, April 16, 12:00pm- 4:00pm.  If all these tiny chips and sensors get you charged up, you can come and build your own!  Free with Museum admission.
  • Explore more light and sound experiments at the Museum of Science, which is hosting a slew of activities throughout the festival!

E. Rosser is a science writer and mechanical engineer currently wrapping up a degree at MIT.  She doesn’t know much about photography, so this question provided a great chance to learn!  When she does reach for the camera, it’s usually to take a cute picture of her pet rats, Ellen and Darwin.  She learned today that maybe she should use a faster shutter speed, since they always scamper around so quickly that they look like a blur...
Ellen and Darwin are camera shy.


  1. Hi, I truly inspire from these blog. You are doing a really a good job & provide us such a gr8 information on Digital Camera & their working. Thanks once again.

  2. You can get more reference to this book: selfie camera Website to know more about the Photos app

  3. Here's how to cut your power bill by 75%:

    Want to know how to easily produce all of the renewable energy you could ever want right at home?

    And you’ll be able to make your home completely immune from power failures, blackouts, and energy grid failures
    so even if everyone else in your area (or even the whole country) loses power - you won’t.


  4. There's a chance you are qualified for a new solar energy program.
    Click here and discover if you qualify now!