Digital cameras use an electronic image sensor that records light as numeric values that are assembled into a digital image file, while compact cameras typically use a CMOS sensor behind the lens and DSLRs usually use a CMOS or CCD sensor combined with an optical viewfinder. The shutter is opened to allow light to hit the image sensor for a fraction of a second, then the image data is processed and stored in the camera's memory as a digital photograph.