Phones with 48-megapixel cameras are now a thing. In fact, I’ve got one on my desk literally right this second. These handsets are capable of producing bigger and more richer photos. To ensure it’s still easy to upload these humongous pictures to the Internet, Facebook today open-sourced a handy tool called Spectrum.
Spectrum is an image processing library for Android and iOS. It aims to improve the reliability of image uploads, while simultaneously making them less demanding on one’s data plan.
Facebook already uses Spectrum in-house across its collection of mobile apps. The library is essentially a one-stop-shop for performing image-manipulation tasks essential to lowering file-sizes and improving reliability — like cropping, resizing, and transcoding.
What makes Spectrum especially interesting is that it doesn’t require developers manually define all behaviors step-by-step. Rather, they state what the desired outcome is, and the library simply takes it from there.
For this to work, Spectrum uses something called “recipes.” These are bundled with the plugins used by the library, and sorted by Facebook to prioritize the most efficient ones. So, for example, the JPEG plugin will include several recipes designed specifically to process JPEG images.
Facebook recently unveiled Spectrum at the droidcon SF conference. The library is available to download today from its GitHub page. While the core of Spectrum is written in C++, Facebook has also released Java and Objective-C APIs in order to make it easier to use the tool.