Facebook ‘Likes’ (And Open Sources) Better Mobile Image Software

But for all the denunciations and castigations (and believe me, I only recently realized I could turn off advertisements based on data from partners and on products seen elsewhere under ‘settings’), there is obviously a lot of good work still going on in Facebook’s software application development and engineering department.

Smartphone photos are huge

The software team at Facebook says that it realizes how massive smartphone photo files are becoming. These files obviously eat up lots of mobile data and can take a long time to load, or sometimes fail to load at all.

“To make the upload process more efficient, we have developed Spectrum, an image processing library for Android and Apple iOS. With Spectrum, we have improved reliability and quality of image uploads at scale across our apps,” said Facebook mobile software engineer Daniel Hugenroth.

Hugenroth explains that Spectrum is free and open source. Version 1.0.0 of the software is available on the GitHub code repository for programmers to use right away. So how does it work?

Step one begins before an image is uploaded. By reducing the file size through transcoding (changing the data file formats), Facebook can quickly reduce data consumption and improve upload reliability. Effectively, transcoding is a ‘simple solution’ that reduces the file size, while maintaining quality. It takes an original image and applies a series of operations (resizing, cropping, rotating etc.) on the image to reduce the size – these are carried out on the actual mobile device that runs the software.

Then, to perform compression, it uses a number of existing libraries (e.g. Mozilla JPEG) to create a final image that is smaller yet preserves as much of the original quality as possible — up to 15% smaller files.

It’s easy to say allegedly negative things about Facebook. You can look at the social network’s relationship with the German government and its so-called Netzwerkdurchsetzungsgesetz hate speech law. You can follow this on to more recent news this year, which suggests that the Germans may start to clamp down on Facebook data even harder.

Avoiding divergent output

Facebook explains that it has taken it upon itself to try and provide enough engineering inside Spectrum to handle the whole process of more efficient image upload here. Hugenroth claims that this is more efficient that using Application Programming Interface (APIs) for image processing usually found inside other software platforms, because numerous mobile platforms and evolving APIs can result in divergent output.

“To serve a broad developer base, platforms hide details and parameters that we want to control to optimize the output. We wanted to make it easier for developers to send smaller files, while maintaining control of the image quality — without writing custom or hard-to-maintain solutions. Spectrum makes common image operations simple, efficient, and consistent for mobile developers. Its declarative API allows developers to focus on the desired output properties instead of the individual steps, said Hugenroth.

As we known, modern smartphones capture high-resolution images… and the large file size makes uploads unreliable on some mobile networks. Often sending it at full resolution is wasteful as the Content Delivery Network (CDN) will resize the image for the recipient anyway.

What to think, going forward

What can we take away from this then… in terms of both Facebook openness (a subject that has occasionally made a few headlines) and actual software competency and prowess on show?