FileTransformFactory

@RequiresApi(value = 21)
public final class FileTransformFactory


Factory for extracting transform info from image files.

This class is for extracting a OutputTransform from an image file saved by ImageCapture. The OutputTransform represents the transform being applied to the original camera buffer, which can be used by CoordinateTransform to transform coordinates between UseCases.

Summary

Public constructors

Public methods

@NonNull OutputTransform

Extracts transform info from the given File.

@NonNull OutputTransform

Extracts transform info from the given InputStream.

@NonNull OutputTransform
getOutputTransform(
    @NonNull ContentResolver contentResolver,
    @NonNull Uri uri
)

Extracts transform info from the given Uri.

boolean

Whether the factory respects the exif of the image file.

void
setUsingExifOrientation(boolean usingExifOrientation)

Whether to include the TAG_ORIENTATION.

Public constructors

FileTransformFactory

Added in 1.1.0
public FileTransformFactory()

Public methods

getOutputTransform

Added in 1.1.0
public @NonNull OutputTransform getOutputTransform(@NonNull File file)

Extracts transform info from the given File.

getOutputTransform

Added in 1.1.0
public @NonNull OutputTransform getOutputTransform(@NonNull InputStream inputStream)

Extracts transform info from the given InputStream.

getOutputTransform

Added in 1.1.0
public @NonNull OutputTransform getOutputTransform(
    @NonNull ContentResolver contentResolver,
    @NonNull Uri uri
)

Extracts transform info from the given Uri.

isUsingExifOrientation

Added in 1.1.0
public boolean isUsingExifOrientation()

Whether the factory respects the exif of the image file.

setUsingExifOrientation

Added in 1.1.0
public void setUsingExifOrientation(boolean usingExifOrientation)

Whether to include the TAG_ORIENTATION. By default, this value is false, e.g. loading image with BitmapFactory does not apply the exif orientation to the loaded Bitmap. Only set this if the exif orientation is applied to the loaded file. For example, if the image is loaded by a 3P library that automatically applies exif orientation.