Spectrum

Spectrum

  • About Spectrum
  • Getting Started
  • GitHub

›Concepts

Intro

  • About Spectrum

Getting Started

  • Getting Started on Android
  • Getting Started on iOS
  • Sample Apps

Concepts

  • Supported Image Flows
  • Supported Image Formats

Using Spectrum

  • Transcoding Images for Upload
  • Resizing Images
  • Cropping Images
  • Rotating Images
  • Encoding Images
  • FAQ

Contributing

  • Project Structure
  • Contributing on Android
  • Contributing on iOS

Supported Image Formats

The current release of Spectrum supports JPEG, PNG and WebP images. Support for additional image formats can be added via its plugin structure. We think that adding support for AVIF (AV1 Image Format) would be great!

JPEG

JPEG files are supported through mozjpeg. The mozjpeg encoder provides up to a 20% improvement of encoding rate compared to standard system encoder. This comes at the cost of a higher encoding time.

Support

  • Spectrum supports lossless transcodes between JPEG files. To leverage it, the following options must be set:
    • Encode requirement mode must be Any or Lossless. See encoding images for more info.
    • No crop requirement or its mode must be ExactOrSmaller. See cropping images for more info.
    • No rotate requirement or should only contain a degrees rotation (no flips / or forcing the up orientation). See rotating images for more info.
  • Images can be encoded as either baseline or progressive JPEG files.
  • Operations between baseline JPEGs may be more memory efficient perform than to, from or between progressively encoded images. This is because the image can be processed scanline by scanline.
  • Wizards can control trellis quantization, scan optimization and choose from predefined quantization tables.
  • Chroma sampling mode can be chosen (420 or 444) to improve quality for graphical content.
  • EXIF metadata (especially orientation) is supported.

Limitations

  • Only 8-bit JPEG images are supported as Mozjpeg doesn't allow being built to support both 8-bit and 12-bit images at the same time.

PNG

PNG files are supported through libpng.

Support

  • When encoding, interlaced output can be enabled via the configuration.

Limitations

  • The compression performance of the underlying zlib isn’t exposed as a user setting yet.

WEBP

WEBP files are supported through libwebp.

Support

  • When encoding, an “image hint” (e.g. graphical, photo) can be set and might be considered by libwebp.
  • Images can either be encoded as lossy or lossless WebP.
← Supported Image FlowsTranscoding Images for Upload →
  • JPEG
  • PNG
  • WEBP
Spectrum
Docs
About SpectrumGetting StartedContributing
Community
FacebookTwitter
Legal
Terms of UseData PolicyCookie Policy
More
GitHubStar
Facebook Open Source
Copyright © 2022 Facebook