@Throws(FileNotFoundException::class) private fun decodeImageForOption(resolver: ContentResolver, uri: Uri): BitmapFactory.Options? { var stream: InputStream? = null return try { stream = resolver.openInputStream(uri) val options = BitmapFactory.Options() options.inJustDecodeBounds = true BitmapFactory.decodeStream(stream, EMPTY_RECT, options) options.inJustDecodeBounds = false options }  finally { closeSafe(stream) } }
Decode image from uri using `` inJustDecodeBounds '' to get the image dimensions .