Spectrum

Spectrum

  • About Spectrum
  • Getting Started
  • GitHub

›Using Spectrum

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

Rotating Images

To rotate an image, define a rotate requirement in the options' transformations. A rotate requirement has the following parameters:

  • Rotate the image by the given degrees. This changes the final image orientation either by changing the metadata's orientation value or reordering the pixels.
  • Flip the image, either horizontally or vertically.
  • Force the up orientation. This ensures that the output does not have a non-default metadata orientation. Instead, the pixel data is rotated. Some image formats do not support a metadata encoded orientation. In this case forcing the up orientation will not have any effect.

Code Sample

The following code rotates the image 90 degrees clockwise while forcing the up-orientation:

Android

final RotateRequirement rotateRequirement =
    new RotateRequirement(
        /* degrees */ 90,
        /* flipVertically */ false,
        /* flipHorizontally */ false,
        /* forceUpOrientation */ true);

// Pass rotate requirement to the options' transformations

iOS

FSPRotateRequirement *rotateRequirement = [FSPRotateRequirement
    rotateRequirementWithDegrees:90
          shouldFlipHorizontally:NO
            shouldFlipVertically:NO
        shouldForceUpOrientation:YES];

// Pass crop requirement to the options' transformations
← Cropping ImagesEncoding Images →
  • Code Sample
    • Android
    • iOS
Spectrum
Docs
About SpectrumGetting StartedContributing
Community
FacebookTwitter
Legal
Terms of UseData PolicyCookie Policy
More
GitHubStar
Facebook Open Source
Copyright © 2022 Facebook