Ever uploaded a JPG image file to your Facebook Status Update, Profile Picture or Cover Picture, only to find its quality is drastically reduced when it appears in your timeline? What was a lovely sharp image with smooth gradients has become smeary and pixelated, particularly around high contrast edges.

This unwanted effect is known as compression artifact, and JPG images are particularly vulnerable to it. Put simply, Facebook compresses uploaded images so their file size is much smaller, which saves on storage and bandwidth costs, but the side effect can be a poor looking image.




Why does Facebook compress images in this way?

Facebook provides image storage free of charge to its users – there is no limit to the number of images you can display on Facebook. But behind the scenes, Facebook has to pay to store the images: costs such as disk drives, bandwidth and data centres must amount to a multi-million dollar bill for them. OK, we can’t feel sorry for them, because they are one of the richest companies on the planet, but even so, it is understandable that they want to reduce their storage and bandwidth outlay.

By compressing images, they reduce their costs. You might upload a 500KB JPG file, but Facebook will compress this down to 100KB or less. This loss of data is responsible for the unwanted artifacts that appear in your image.

Example

To demonstrate the extent of the Facebook image compression, let’s look at an example. I uploaded a larger version of this image to our Facebook status update:

Facebook image compression example

Image by koratmember / FreeDigitalPhotos.net

The original image uploaded was 192KB. When it appeared on Facebook, it had been compressed to just 32KB. That is a huge 83% reduction, and as a result, we see nasty artifacts. Look at the smearing around the edges of the image content:

Comparison between original image and Facebook's compressed version

Does it really matter?

For most Facebook users, probably not. The issue is not as noticeable on photographs as it is on illustrations with solid colour (as in our example above). And besides, photos shared directly from camera phones are already compressed and have quality issues to start with.

Yes, it does matter … (for us anyway!)

We often upload promotional images to our Facebook status update, and we pay Facebook to share them as sponsored posts. We find it objectionable to have to pay Facebook to share an image that has been degraded by Facebook. We are particularly sensitive to this, because we are a picture library website and our stock needs to look good!

What does Facebook say about it?

Facebook is aware of the problem and has issued its own guidance.

Two bits of advice are not entirely helpful. Facebook says:

… make sure to select the High Quality option when you upload

This is fine if you are uploading to a Facebook Album, because there is indeed a check box for “High Quality”. This helps prevent over-compression. However, uploading images directly into the Status Update, Profile Picture or Cover Picture does not have the high quality check box.

To avoid compression when you upload your cover photo, make sure the file size is under 100 KB.

In our experience, this makes absolutely no difference. We have taken great care to upload a decent looking image at 97KB only to see if compressed to 36KB and ruined.

The solution – use PNG format!

If you are reasonably savvy with image formats and graphics software, try saving your image as a PNG 24. This may well give you a higher file size to start with, but in our experience, Facebook is not applying compression to PNGs. Of course, this might change in the future, but for now this is our solution.

Use with care

A word of warning. PNGs can be considerably larger files than their JPG equivalent, and this might impose longer download times for your Facebook fans. We still use JPG images most of the time, but for certain types of image we consider using PNGs to avoid awful compression. We don’t use PNGs for photographs, we use them for illustrations with high contrast solid edges.

What about Profile Pictures and Cover Pictures?

This technique works for them too. Our Profile picture always looked smeary until we recently replaced it with a PNG version, and now it is fine.