Facebook open sources Spectrum for efficient uploading of images

Facebook launches open-sourced Spectrum for better mobile image production

Facebook has officially released an open source tool to the developer community to make the process of uploading images more efficient.

Dubbed as “Spectrum”, this tool is a cross-platform image transcoding library that can easily be integrated into an Android or iOS project to efficiently perform common image operations. It aims to improve the reliability and quality of image uploads while reducing image uploading time and mobile data consumption.

“As modern smartphones capture high-resolution images, the large file size makes uploads unreliable on some mobile networks. Sending it at full resolution is often wasteful, as the content delivery network (CDN) will resize the image for the recipient anyway,” said Facebook mobile software engineer Daniel Hugenroth.

“Resizing the image on the sender’s device reduces the bandwidth required to send the image. As a result, the entire pipeline has minimal payload overhead, improving the end-to-end experience. The remaining challenge is how to maintain image quality while benefiting from the smaller file.”

Spectrum uses a “declarative” API that allows developers to focus on the desired output properties instead of the individual steps. It prefers a lossless operation for cropping and rotating JPEG images, while in resizing it “optimizes the interplay between decoder sampling and pixel-perfect resizing.” It also uses C/C++ code for higher performance with Java and Objective-C wrapper APIs to make development easier.

Spectrum integrates with native image compression libraries, including MozJpeg, that allows to control encoding parameters beyond the general-purpose platform APIs. It allows developers to utilize computationally intensive encoding, which requires more processing time but significantly reduces the file size. Additionally, it enables control over more advanced parameters such as chroma subsampling to improve the quality of images with sharp edges and illustrations.

“The consistent API makes these features accessible to developers who are not image experts,” Hugenroth added.

“We hope Spectrum will benefit developers in the same way it has helped Facebook create a better image production experience. In our apps, Spectrum has improved the reliability and quality of image uploads at large scale across our apps. The default integration with Mozilla JPEG allows a reduction of up to 15 percent in upload file size compared with a baseline encoder. We are excited to see how the community uses the Spectrum 1.0.0 library to improve the photo experiences in applications.”

The open source project ‘Spectrum 1.0.0’ is now available on GitHub code repository.

Kavita Iyer
Kavita Iyerhttps://www.techworm.net
An individual, optimist, homemaker, foodie, a die hard cricket fan and most importantly one who believes in Being Human!!!

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Read More

Suggested Post