readBitmap

fun readBitmap(file: File, size: Pair<Int, Int>? = null, scale: Int? = null): Bitmap?

Reads the contents of a file and converts them into a Bitmap.

Author

Arnau Mora

Since

20210713

Return

The read Bitmap, or null in case of an error.

Parameters

file

The file to read from.

size

The size of the container where the image will be loaded at. This can be null, and the whole image will be loaded, but it's recommended to select a size, so no memory is wasted.

scale

The scale to load the image at. This will optimize memory usage, and make the device be not that much stressed.