FileTransformFactory

public final class FileTransformFactory
extends Object

java.lang.Object
   ↳ androidx.camera.view.transform.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

FileTransformFactory()

Public methods

OutputTransform getOutputTransform(ContentResolver contentResolver, Uri uri)

Extracts transform info from the given Uri.

OutputTransform getOutputTransform(InputStream inputStream)

Extracts transform info from the given InputStream.

OutputTransform getOutputTransform(File file)

Extracts transform info from the given File.

boolean isUsingExifOrientation()

Whether the factory respects the exif of the image file.

void setUsingExifOrientation(boolean usingExifOrientation)

Whether to include the ExifInterface.TAG_ORIENTATION.

Inherited methods

Public constructors

FileTransformFactory

public FileTransformFactory ()

Public methods

getOutputTransform

public OutputTransform getOutputTransform (ContentResolver contentResolver, 
                Uri uri)

Extracts transform info from the given Uri.

Parameters
contentResolver ContentResolver

uri Uri

Returns
OutputTransform

Throws
IOException

getOutputTransform

public OutputTransform getOutputTransform (InputStream inputStream)

Extracts transform info from the given InputStream.

Parameters
inputStream InputStream

Returns
OutputTransform

Throws
IOException

getOutputTransform

public OutputTransform getOutputTransform (File file)

Extracts transform info from the given File.

Parameters
file File

Returns
OutputTransform

Throws
IOException

isUsingExifOrientation

public boolean isUsingExifOrientation ()

Whether the factory respects the exif of the image file.

Returns
boolean

setUsingExifOrientation

public void setUsingExifOrientation (boolean usingExifOrientation)

Whether to include the ExifInterface.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.

Parameters
usingExifOrientation boolean