# What is the Compression Algorithm used by Facebook?

I would like to know what is the Compression Algorithm used by Facebook for compressing the images? I uploaded a image of size 242 Kb and I downloaded the same image from my Facebook album. The size of downloaded image is 46 Kb and the subjective quality is similar, I wasn't able to differentiate between the original (uploaded) and downloaded (from Facebook) image. The downloaded image was downsampled though, from 1226 x 1600 to 552 x 720. So Facebook compresses the image at a good ratio while we are uploading it to our Facebook account without affecting the subjective quality much.

I wonder what compression algorithm they are using for this purpose. What would be your best guess?

                           Original image: tamil_girl_painting (size 1226 x 1600)


                  Downloaded (from Facebook) image: tamil_girl_painting (size 552 x 720)


• I'll bet it is proprietary.
– John
Jan 23, 2014 at 11:37
• Ask Mark Zuckerburg I am sure he will tell you. :P Jan 23, 2014 at 12:40
• Well, if it were proprietary, your browser would not be able to display it! Probably just a lower quality of JPEG... Maybe you could post your original file and the download from facebook? Jan 23, 2014 at 13:04
• I would suggest vanilla JPEG. At the very best JPEG + a fancy perceptual diff in the loop to see how low they can go with the quality settings without hurting much a perceptual quality score... But I doubt they would bother doing that. Jan 23, 2014 at 13:45
• @JasonR Just now I checked.. Yes the image has been downsampled.. Original Image dim: 1226 x 1600 and the downloaded image dim: 552 x 720 .. Jan 24, 2014 at 3:47

From the images you posted its quite clear that the image has been downsampled and re-compressed with lower quality jpeg settings. If you look round the mouth you can clearly see JPEG-like artefacts.

• I too think so.. I uploaded different file formats i.e) tiff, png etc and all were converted to JPEG.. I couldn't able to save them in any format other than JPEG. Is there any other algorithm more efficient than JPEG?? Why JPEG2000 is not widely used? Jan 24, 2014 at 13:07
• I believe JPEG2000 is minimally used because it is encumbered by patents.
– John
Jan 24, 2014 at 16:23
• @PremnathD: jpeg2000 is covered by patents, yes, but AFAIK the baseline jpeg2000 stuff can be used royalty-free. Thing is, JPEG2000 support is weak and it's a more complex format. Basically, the old JPEG is "good enough". And if you want to squeeze out some further bits, it's worth downsampling the image before it looks too blocky -- which is apparently what Facebook does Jan 27, 2014 at 15:46
• TBH JPEG 2K is only really worth it when you go to extreme compression levels. Unfortunately when you go to such levels the quality loss is already so bad as to not make it worthwhile. I've used a similar wavelet compression to have 100+:1 compression but I really wasn't all that worried by the artefacts ...
– Goz
Jan 27, 2014 at 21:35

ImageMagick's "identify -verbose" says it's JPEG. The sample image here has quality 77, while several recent ones of mine that I checked just now have either "quality 71" or "quality 74". All of them have 2x downsampling of the chroma channels. Most of the time I have uploaded high-quality (IJG quality 92) JPEGs without donwsampling.

Some have Facebook's "tinysrgb" profile while others have one of the color.org sRGB profiles. I haven't yet figured out how these choices are made, or how to influence them.