So you’re into photography and while you’re showing some skill and getting a handle on camera settings for the perfect shot; what happens when you’re done?

You’ve heard the term “Jay-peg” splashed about and file size and image quality and quite frankly, you need to be in on the know.

You have come to the right place! By the end of this read you’ll be a jpeg aficionado, or at the very least – you’ll be able to hold your own in photography discussions 101.

Let’s start with the basics. A digital file is a format of how your image is stored. The type of file format that your image is stored in; directly affects the quality of the image.

The three most common types of digital file formats are JPEG (lossy format), TIF (lossless format), and RAW (the actual in-camera format, also lossless).

What are Jpg, TIF, and RAW files?

JPEG, JPG, or even JPE stands for Joint Photographic Experts Group. It is a common standard image format, developed in the 1980s that contains lossy (more on that later) and compressed digital image data. It works the best for photographic images rather than images of text because it works with the blending of color.

The JPEG standard refers to both the technique for compressing an image into a stream of bytes and then decompressing it back close to its original form and the file format holding that stream. Jpeg files reduce huge image files, managing to maintain reasonably good image quality.

The JPEG image file format is popular because it offers an astoundingly effective method of compressing color images. Such images can be compressed up to only 5% of their original size, which means two things (expanded on below).

Firstly, these smaller files take up less disk space for storage on your device and it makes these files easily and widely spread and used on the internet, computers, and various mobile devices. A jpeg image can be shared easily, quickly, and efficiently!

Secondly, this format allows you to create smaller graphics, with a small loss of image quality. Jpg images will lose some details of the original image (having been compressed), but these losses and quality changes are invisible to our eyes. Unless of course, you have some intense Eagle-eye vision and attention to detail!

And, even though their formats are generally lossy; they can contain high-quality image data with nifty lossless compression.

In a nutshell, jpeg files are often used for digital camera images because they are a fairly small file size for the quality that they display. Also, although they are a lossy format; they offer a higher compression rate than PNG files.

TIF/TIFF – This is a lossless image format (when you don’t use JPEG compression within), i.e. no pixels are modified in the image. TIFF stands for Tag Image File Format. This results in very large image sizes (computer file size).

TIF can be compressed, using either LZW or ZIP. Using LZW or ZIP shrinks the TIF image without data loss. TIF is a favorite because it can contain more photo information than a JPEG image.

RAW – This is a lossless image format on some digital cameras. RAW is the direct unprocessed image as seen by the camera’s sensor. It allows post-image processing using any of the camera parameters (i.e. sharpness, contrast, etc.).

Professional photographers prefer this format for their image “negatives” (originals) because it allows the best post-processing flexibility.

What kind of digital images are photographs? Digital images are made up of picture elements, which we call pixels. These pixels each represent a numeric value for their gray level and intensity.

In layman’s terms; a pixel is the smallest individual element of any digital image representing the brightness of color at any given point. Whew.

Think of it as a micro mosaic picture, or a cross-stitch. The closer you get to the image the more clearly you can see all the tiny little squares individually (adjacent pixels), but the further you step away from the image all the little squares begin to blend and become part of a bigger picture.

Jpeg Compression: Image compression method explained

JPEg is one of the most common methods used for losing compression of digital images especially those taken with digital cameras – The compression level is adjustable, allowing a range of storage sizes versus image quality. JPEG usually has 10:1.

Compression and low sensitivity to fading of images. From 1992 onward, JPEG is now the most widely used digital image format. We compress images to reduce their file sizes and also to change various attributes, namely file type, resolution, the dimension of the image, and bit depth.

There are two compression methods; these are either Lossy Compression or Lossless Compression.

Lossy Compression

The compression process for most large images, especially common in digital photography is Lossy. here are some things about this jpg compression that you need to know:

At its root, it eliminates all “unnoticeable” data in an original image when you save it to make it a smaller file size. In Lossy Compression a file cannot be restored to its original form. You lose information that you can never get back.

With this type of compression, the picture quality is compromised as well, because it reduces the actual size of the data. In jpeg (lossy format), the image file size is reduced by blending “redundant” image pixels. As the image is compressed blurriness appears around the edges of objects in the photo.

You’ll be interested to know that the algorithm used for Lossy Compression is Discrete Cosine Transform because it has very strong energy compaction, i.e. a large amount of information is stored in very low-frequency components which can be stored by using a less number of bits (usually, at most 2 or 3 bits).

This type of compression does not eliminate any data (even the “unnoticeable” stuff). If a file has been compressed in this way it can be restored to its original form and quality.

It does not compromise the quality of the data, and it doesn’t reduce the size of the data. One more thing; this kind of compression is also known as reversible compression.

And if it is a digital photo being compressed; the image quality and the image size remain completely unaffected! Whoop! So how does it work? How do you make a file smaller without losing anything? The answer is in the algorithms used in the encoding method. We’ll talk about two, namely:

Run Length Encoding –  This is a type of data compression where a “run” of identical values is replaced by codes to show the value and the number of times it occurs. So, a run of 70 spaces can be replaced by two bytes. One byte indicates the run consists of spaces and one byte indicates there are 70 of them.

Huffman Encoding – The idea is to assign variable-length codes to input characters, lengths of the assigned codes are based on the frequencies of corresponding characters. The most frequent character gets the smallest code and the least frequent character gets the largest code.

The variable-length codes assigned to input characters are prefix codes, which means the codes (bit sequences) are assigned in such a way that the code assigned to one character is not the prefix of code assigned to any other character; thus ensuring that there is no ambiguity when decoding the generated bitstream.

So then, what is the best compression ratio for JPEG images? The optimal ratio for retaining photo quality is 10:1. This maximum ratio is used in capturing high-resolution photos that can be compressed to reduce file sizes.

You can control the jpg quality results by choosing from a range of compression algorithms when creating a jpeg file or converting images from other formats to JPEG.

So, jpg quality (of images saved) is directly proportional to the file size, so, the bigger the file, the more preserved its original properties will remain.

Is JPEG lossless when quality is set to 100?

No. JPG 100 has a compression ratio of 2.6:1. JPG 100 has the least compression giving you a higher quality image whereas JPG 20 has the highest compression giving you the smallest file size but the lowest quality as well.

So, JPG 100 gives you a good-quality image (inasmuch is possible for such files) and JPG 20 gives you a low-quality image (with a serious loss of fine detail from the original image). Getting more technical, it’s explained by Marco Fontani on Stack Overflow like this:

In JPEG compression information is mostly lost during the DCT coefficient quantization step (8-by-8 coefficient blocks are divided by an 8-by-8 quantization table, so they become smaller –> ‘more compressible’).

When you set JPEG quality to 100, no real quantization takes place (because the quantization table will be all 1s, at least with standard IJG-JPEG tables), so in fact, you don’t lose information here. There are mainly two factors leading to information loss even when no quantization takes place:

  1. Typically, JPEG compression reduces color information (because the human visual system is less sensitive to that than to luminance). Therefore, even at quality 100, you may be carrying out chrominance subsampling (which means, dropping half or more Cb and Cr coefficients).When this happens, information is lost, even when no quantization happens. However, you can tell the encoder to preserve full chrominance (so-called 4:4:4 color sampling).
  2. Nevertheless, JPEG encoding implies going to the DCT domain, which causes rounding of coefficients. Rounding discards some information. This will happen regardless of all other options.

So, the role of a quantization matrix is to reduce the number of bits needed to store an integer value by reducing the precision of the integer. Given a matrix of DCT coefficients, we can generally reduce the precision of the coefficients more and more as we move away from the DC coefficient.

Photo Quality Settings

Ken Watson at All About Digital Photos says, “Most cameras will show JPEG image quality settings of something like low (high compression), fine (moderate compression), and superfine (low compression). This is not to be confused with image size, they are two different things (cameras generally show image size as small, medium, and large which relate to the pixel dimensions of the image).

In photo editing, computer programs JPEG compression is usually expressed as a percentage where 100% is no compression and 0% is maximum compression (think 100% quality vs. 0% quality). Usually, visible distortion starts to appear at 50%.

Adobe Photoshop uses a sliding scale from 0 to 12* (really 0% to 100%). Once compressed in this format an image cannot be uncompressed (you cannot regain the original quality). This is why the original photo (your digital negative) should be taken with as little compression as possible.

A problem with using a JPEG file as your editing original is that each time you do a “save as” with a JPEG after editing it further degrades, even if the JPEG compression is set to the highest quality.

The degradation is not severe, but those who wish to maintain the best quality of their images will first “save” their image into a format such as TIF and then do all their editing in that format. The final image can be saved back as a high-quality JPEG.

Note that you can copy a JPEG file using your computer’s copy function, multiple times with no loss of quality (like all digital files) – it is just the re-saving of a JPEG from any photo editing program after editing (or even cropping) that will add to the degradation of the image.”

Jpeg quality and file size Pros: A small image size, a pretty good photographic reproduction, and the best format for emailing or when you upload images to the web, compatible with virtually most image software.

Jpeg quality and file size Cons:  Compression possibly affecting image quality, the loss of “sharp edges” (that slightly softer looking image), the jpeg quality “lossy” format compresses information that can’t be recovered, and photodegradation after editing on save (even at maximum quality setting).

Related: What are JPEG Artefacts?


Ultimately JPEG is good for working with online photos and artwork. The highest jpg quality image format lets you have flexibility with raster editing and compression.

As a result, the images that you save for web use can be uploaded and downloaded quickly. The images (such as photos or artwork) saved in JPEG format are great for editing and printing thanks to a high resolution with low compression.