public class

JpegTranscoderUtils

extends Object
java.lang.Object
   ↳ com.facebook.imagepipeline.transcoder.JpegTranscoderUtils

Summary

Constants
int DEFAULT_JPEG_QUALITY
int MAX_QUALITY
int MAX_SCALE_NUMERATOR
int MIN_QUALITY
int MIN_SCALE_NUMERATOR
int SCALE_DENOMINATOR
Fields
public static final ImmutableList<Integer> INVERTED_EXIF_ORIENTATIONS
Public Constructors
JpegTranscoderUtils()
Public Methods
static int calculateDownsampleNumerator(int downsampleRatio)
This method calculate the ratio in case the downsampling was enabled
static float determineResizeRatio(ResizeOptions resizeOptions, int width, int height)
static int getForceRotatedInvertedExifOrientation(RotationOptions rotationOptions, EncodedImage encodedImage)
Get an inverted exif orientation (2, 4, 5, 7) but adjusted to take the force rotation angle into consideration
static int getRotationAngle(RotationOptions rotationOptions, EncodedImage encodedImage)
static int getSoftwareNumerator(RotationOptions rotationOptions, ResizeOptions resizeOptions, EncodedImage encodedImage, boolean resizingEnabled)
static Matrix getTransformationMatrix(EncodedImage encodedImage, RotationOptions rotationOptions)
Compute the transformation matrix needed to rotate the image.
static boolean isExifOrientationAllowed(int exifOrientation)
static boolean isRotationAngleAllowed(int degrees)
static int roundNumerator(float maxRatio, float roundUpFraction)
[Expand]
Inherited Methods
From class java.lang.Object

Constants

public static final int DEFAULT_JPEG_QUALITY

Constant Value: 85 (0x00000055)

public static final int MAX_QUALITY

Constant Value: 100 (0x00000064)

public static final int MAX_SCALE_NUMERATOR

Constant Value: 16 (0x00000010)

public static final int MIN_QUALITY

Constant Value: 0 (0x00000000)

public static final int MIN_SCALE_NUMERATOR

Constant Value: 1 (0x00000001)

public static final int SCALE_DENOMINATOR

Constant Value: 8 (0x00000008)

Fields

public static final ImmutableList<Integer> INVERTED_EXIF_ORIENTATIONS

Public Constructors

public JpegTranscoderUtils ()

Public Methods

public static int calculateDownsampleNumerator (int downsampleRatio)

This method calculate the ratio in case the downsampling was enabled

Parameters
downsampleRatio The ratio from downsampling
Returns
  • The ratio to use for software resize using the downsampling limitation

public static float determineResizeRatio (ResizeOptions resizeOptions, int width, int height)

public static int getForceRotatedInvertedExifOrientation (RotationOptions rotationOptions, EncodedImage encodedImage)

Get an inverted exif orientation (2, 4, 5, 7) but adjusted to take the force rotation angle into consideration

Throws
IllegalArgumentException if encoded image passed doesn't have an inverted EXIF orientation

public static int getRotationAngle (RotationOptions rotationOptions, EncodedImage encodedImage)

public static int getSoftwareNumerator (RotationOptions rotationOptions, ResizeOptions resizeOptions, EncodedImage encodedImage, boolean resizingEnabled)

public static Matrix getTransformationMatrix (EncodedImage encodedImage, RotationOptions rotationOptions)

Compute the transformation matrix needed to rotate the image. If no transformation is needed, it returns null.

Parameters
encodedImage The EncodedImage used when computing the matrix.
rotationOptions The RotationOptions used when computing the matrix
Returns
  • The transformation matrix, or null if no transformation is required.

public static boolean isExifOrientationAllowed (int exifOrientation)

Returns
  • true if and only if given value is a valid EXIF orientation

public static boolean isRotationAngleAllowed (int degrees)

Returns
  • true if and only if given number of degrees is allowed rotation angle, that is it is equal to 0, 90, 180 or 270

public static int roundNumerator (float maxRatio, float roundUpFraction)