Yesterday, Facebook open-sourced Spectrum 1.0.0, a cross-platform image transcoding library for Android and iOS that makes uploading larger images easier. Spectrum has also improved the reliability and quality of image uploads across all Facebook apps. With Spectrum now open source, users can fully debug it and add support for new codecs using its plugin architecture.
Facebook uses Spectrum in-house across all of its mobile apps. It is an all in one package for performing image-manipulation tasks for lowering file-sizes and improving resizing, cropping, and transcoding.
Spectrum uses Mozjpeg to achieve higher quality file size ratio. Spectrum makes image operations easier by cropping and rotating lossless. It focuses on increasing the quality for graphical content with operations like disabling chroma sampling.
Since Spectrum’s API is declarative, it helps in preventing common missteps such as incomplete handling of EXIF metadata.
It is written in portable C/C++ so users can adopt it to their environment. Java and Objective-C APIs are thin wrappers around the C++ core that makes development easier. C++ core allows higher execution speed for computational operations and provides control over allocations. This core allows sharing between apps on Android and iOS which makes outputs more consistent.
Spectrum is unique because it does not require developers to manually, step-by-step define all behaviors. Instead, the developers just state what the desired outcome is, and the library takes it from there. Spectrum makes this possible by using ‘recipes’, that are bundled with the plugins used by the library and sorted by Facebook. Recipes help developers in choosing the optimal execution sequence for individual requests. For example, the JPEG plugin will provide recipes for the lossless cropping and rotation of JPEG images.
Integration with MozJpeg, a native library, helps Spectrum to control encoding parameters beyond the general purpose platform APIs. It helps developers to utilize intensive encoding, which requires more time for processing but significantly reduces the file size.
Hacker news users are excited about this news and are relieved that they don’t have to recreate a bunch of scaffolding around image encoders. Users are also comparing this library with other apps like ImageOptim, a free Mac app that can handle JPEG, GIF and PNG and Google’s Guetlzi that can reach 20-40% compression without any loss of quality.
All is not bright, however. Users have also expressed concerns with using Spectrum saying that Facebook provides the worst image compression. One user commented on HackerNews, “Facebook photos are compressed to a point where they look horrible. Why would anyone want to use this? I do not see what this benefits any developer over just using mozjpeg with better settings.”
Some users are unhappy with Messenger videos too. Another user commented, “If any Facebook compression engineer reads this, please fix the sound in Messenger videos! The sound bitrate is absolutely terrible, only for ridiculous bandwidth savings.”
Also, there are issues with the name as there are other products with the same name. A comment reads, “I like how there are 2 products called Spectrum on the front page and they are completely unrelated. Anyway, this lib looks pretty ok for its purpose.” Another comment reads, “There’s also the article that wants to sell you a spectrum analyzer to search your hotel room for bugs.”
Facebook plans to invest $300 million to support local journalism
I remember deciding to pursue my first IT certification, the CompTIA A+. I had signed…
Key takeaways The transformer architecture has proved to be revolutionary in outperforming the classical RNN…
Once we learn how to deploy an Ubuntu server, how to manage users, and how…
Key-takeaways: Clean code isn’t just a nice thing to have or a luxury in software projects; it's a necessity. If we…
While developing a web application, or setting dynamic pages and meta tags we need to deal with…
Software architecture is one of the most discussed topics in the software industry today, and…