About Talks Articles

Portrait Mode and JPEG Compression

3 min read

High-end smartphones, such as the latest Apple iPhone and Google Pixel 2, offer the so-called Portrait Mode when taking pictures. This mode blurs the background so that the foreground object stands out, thereby creating a professional-looking photo with almost zero effort. Fortunately, this act of blurring the background also reducing the size of the JPEG file of that picture.

Regular vs Portrait Mode

In a nutshell, JPEG compression works by reducing the details which our eyes do not pay attention to. This is why when you enlarge a JPEG image, at some point you will start to spot the artifacts (which you do not observe at a normal zoom level), e.g. unnatural patterns of colors. Eliminating those details allow JPEG to store all pixel colors in a much more efficient manner. JPEG is thus useful to compress pictures taken from a camera.

For the so-called JPEG power users, this characteristc can be exploited further to help increasing the compression ratio. For instance, blurring an image certainly will reduce some details, thereby making it even easier for JPEG to get rid of more redundant informations, resulting in an even more smaller file. Of course, it does not make sense to blur the entire image and hence this technique is usually being applied just to the background. The foreground object stays sharp, the background becomes slightly more blurry, the file size goes down. Meanwhile, whoever enjoys the photo might not realize of all the trickery and yet they will likely enjoy a faster loading image (due to the smaller size).

Thanks to the new shallow depth-of-field effect, part of the camera setup of some smartphones or through the use of foreground-background segmentation, producing blurry background can be automated. In fact, most people prefer it since the foreground object will stand out better. Take a look at the two photos on the right, the top is just a regular one while the bottom is where Portrait Mode was applied. Even without any additional post-processing or editing, the bottom photo looks fantastic!

As a bonus, using Portrait Mode gives a smaller file size as well, as shown in this chart.

Comparing the file sizes

This was with the original image dimension, 12 megapixels. For the practical purpose of showing the photo in a gallery or sharing it with a friend, this dimension is overkill. Making the image smaller, along with using a state-of-art JPEG decoder such as MozJPEG or Guetzli will yield further savings.

As the conclusion, use Portrait Mode whenever possible. You will likely get a more decent shot and could get the benefit of sending the file faster!

Related posts:

♡ this article? Explore more articles and follow me Twitter.

Share this on Twitter Facebook