Stay organized with collections Save and categorize content based on your preferences.

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

public FileTransformFactory()

Public methods

getOutputTransform

public @NonNull OutputTransform getOutputTransform(@NonNull File file)

Extracts transform info from the given File.

Throws
java.io.IOException java.io.IOException

getOutputTransform

public @NonNull OutputTransform getOutputTransform(@NonNull InputStream inputStream)

Extracts transform info from the given InputStream.

Throws
java.io.IOException java.io.IOException

getOutputTransform

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

Extracts transform info from the given Uri.

Throws
java.io.IOException java.io.IOException

isUsingExifOrientation

public boolean isUsingExifOrientation()

Whether the factory respects the exif of the image file.

setUsingExifOrientation

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.