10

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)

Original Image

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

Compressed Image

Premnath D
  • 1,011
  • 2
  • 14
  • 25
  • 1
    I'll bet it is proprietary. – John Jan 23 '14 at 11:37
  • 1
    Ask Mark Zuckerburg I am sure he will tell you. :P – Tarin Ziyaee Jan 23 '14 at 12:40
  • 3
    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? – pichenettes Jan 23 '14 at 13:04
  • Any idea what the algorithm will be? Guess – Premnath D Jan 23 '14 at 13:19
  • 3
    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. – pichenettes Jan 23 '14 at 13:45
  • I agree with what pichenettes said; it's likely just a lower-quality JPEG. Did you also check to see whether it has the same dimensions as the original? It could just be downsampled (images can look good on-screen with relatively low dots-per-inch rates). In any event, I'd say this question is unlikely to get a good, authoritative answer, unless someone who works at Facebook wants to share. – Jason R Jan 23 '14 at 16:40
  • @pichenettes: Like many file formats, JPEG does describe how the image must be decompressed. But it's a lossy format, and it's up to the implementor of the encoder to decide what to discard. That decision critically influences the perceived quality. – MSalters Jan 23 '14 at 17:04
  • 1
    @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 .. – Premnath D Jan 24 '14 at 03:47
  • I would just like to remind the community (especially for those who cast the close votes) that we had a question exactly like this about Google "image by image search" algorithm which was deemed good by the community. – penelope Jan 27 '14 at 15:37

2 Answers2

7

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.

Goz
  • 475
  • 1
  • 9
  • 21
  • 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? – Premnath D Jan 24 '14 at 13:07
  • I believe JPEG2000 is minimally used because it is encumbered by patents. – John Jan 24 '14 at 16:23
  • 1
    @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 – sellibitze Jan 27 '14 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 '14 at 21:35
2

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.