Facebook open-sources Spectrum 1.0.0 for better mobile image production on Code.fb.com, Facebook's Engineering blog

As mobile camera hardware rapidly improves, our phones capture and store larger and larger files. Uploading these large files can eat up mobile data; it can take forever for them to load; and, sometimes, the files fail to load at all. To make the upload process more efficient, we developed Spectrum, an image processing library for Android and iOS. With Spectrum, we have improved the reliability and quality of image uploads at a large scale across our apps. We recently presented Spectrum as an open source project at droidcon SF, and, today, we are officially releasing Spectrum 1.0.0 on GitHub.

The path to better mobile image production

Step one begins before an image is uploaded. By reducing the file size through transcoding, we can quickly reduce data consumption and improve upload reliability. It’s a simple solution, but reducing size while maintaining quality requires a deep understanding of the various processing steps and image formats.

Using the platform-provided APIs for image processing is one possible solution. But 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. Often, common tasks, such as interpretation of EXIF metadata, can result in code duplication that hinders maintenance and global improvements. And making use of the latest compression libraries, such as MozJpeg, requires writing native code in C/C++. We wanted to make it easier for developers to send smaller files while maintaining control of the image quality — without needing to write custom or hard-to-maintain solutions.