Digital photography file formats

I often refer to the various file formats used in digital photography and image editing and thought some Sciencebase readers might be interested in a very brief summary of what those formats are about. Fundamentally, I shoot in RAW and process with DxO PureRaw 3 followed by Topaz Sharpen AI (not every time) and PaintShop Pro. The final images I share are usually resized to 2048 pixel-width, unless I’ve had to crop it to smaller than that, and compressed to 90% JPG quality.

You can think of RAW as being a digital film negative (although the colours are not inverted) and every other format is like a print from that negative.

Definitions and brief explanations:

    1. RAW (Raw Image File):
      • Definition: RAW is a file format that captures all the data from the camera’s image sensor without any processing or compression. RAW files offer greater flexibility for post-processing and editing, allowing photographers to make precise adjustments without loss of quality. However, they usually require specialized software to view and edit.
    2. TIFF (Tagged Image File Format):
      • Definition: TIFF is a flexible file format that supports lossless compression and is widely used for storing high-quality images. TIFF files are known for their versatility and ability to maintain image quality. TIFF files can store multiple layers, transparency, and high-bit-depth images, making them ideal for professional photographers and graphic designers. However, TIFF files tend to have larger file sizes compared to other formats.
    3. JPG/JPEG (Joint Photographic Experts Group):
      • Definition: JPG/JPEG is a commonly used file format that uses lossy compression to reduce file size while maintaining acceptable image quality. JPG is a popular format for sharing and displaying photographs on the web and social media due to its small file size. It achieves compression by discarding some image data, which may result in a slight loss of quality. JPG files are widely supported by software, devices, and web browsers, making them suitable for online use. Successive editing and re-saving of JPG files leads to increasing loss of quality.
    4. PNG (Portable Network Graphics):
      • Definition: PNG is a file format that supports lossless compression and is particularly well-suited for images with transparent backgrounds or sharp lines and text. Ideal for logos, icons, and graphics with sharp edges. Not so well suited for large photographs.
    5. GIF (Graphics Interchange Format):
      • Definition: GIF is a file format these days primarily used for animated images or short looping videos. Originally, it was an efficient compression format for photographs that is in some ways lossless but limits the colour palette to 256-bits.
    6. BMP (Bitmap):
      • Definition: BMP is a file format that stores images as uncompressed bitmaps, which means large file sizes. They offer excellent image quality and are often used in professional printing.

Sciencebase reader Andy, was puzzled as to why sometimes his edited image files in JPG format are bigger than the original RAW file. After all, JPG is a compressed format, he says, shouldn’t the file be smaller?

Well, the basic RAW file is like a 1:1 grid of every pixel value recorded by your camera’s sensor. It does contain some extra info too like camera settings, geotags, name, time-date stamp etc, and even a compressed jpg copy of the photo (that copy is used to display the image on your camera’s screen).

When you edit import and edit the RAW image, your processing, levels adjustment, white balance correction, sharpening etc, can add information about how you have changed the values for each of those pixels in the file. Now, when you save it, if you choose minimal jpg compression, then all that extra data is simply stored in the file so it gets bigger.

However, if you save the edited file with a higher compression ratio, then the compression process looks at the pixels, indeed whole areas of pixels to see how it can save space. Those pixels in an area with similar values, say an area of blue sky, are then compressed by saving the data for one typical pixel and then adding a snippet of code to say that so many nearby pixels are the same. This uses up a lot less space than keeping all the data for every single pixel. The redundant data is discarded. The higher the compression ratio the smaller the final file, but the lower the quality and the more artefacts, such as distortion and fringing.