fromUri

fun fromUri(contentResolver: ContentResolver, uri: Uri): ImageSource

Creates an image source from a content URI.

When the URI is backed by a file it is read as needed while decoding, without copying it into memory. Otherwise the encoded image is read from a stream and kept in memory.

Return

created image source, which must be closed when no longer needed.

Parameters

contentResolver

resolver used to open the URI.

uri

URI of the encoded image.

Throws

if the URI cannot be opened or its format is not supported.