When you take a photo in Lightroom, the camera captures the image as a Bayer matrix. This is a three-dimensional image that is stored in memory and can be used to create prints or digital photos. When you save a photo as a JPEG, the camera saves the image as an RGB matrix. This is a two-dimensional image that can be used to create prints or digital photos. The Lightroom software uses these three types of images to create your final photo.