Facebook has made Spectrum, an image processing library for Android and Apple iOS developed in-house, available to the public.
Facebook’s software application development and engineering department says that Spectrum allowed the social network upload images more efficiently. "With Spectrum, the team has improved reliability and quality of image uploads at scale across our apps," said Facebook mobile software engineer Daniel Hugenroth.
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.
By using Mozjpeg, Spectrum achieves a higher quality to file size ratio, common operations such as cropping and rotating can be executed lossless, and codec specifics like disabling chroma sampling increase the quality for graphical content.
Because Spectrum's API is declarative, you define the output characteristics of the image and Spectrum does the complicated orchestrating for you. This helps to prevent common missteps such as incomplete handling of EXIF metadata.
Spectrum is Open Source meaning you can fully debug it and you can add support for new codecs using its plugin architecture. It is built with cross platform for mobile in mind and written in portable C/C++ so that you can adopt it to your environment.
“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.