Add feature - get Image's Width, Height, Mimetype without load bitmap into Memory
WindSekirun opened this issue · 1 comments
WindSekirun commented
Add feature - get Image's Width, Height, Mimetype without load bitmap into Memory
WindSekirun commented
Prototype:
fun String.getImageWidth(): Int {
val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
BitmapFactory.decodeFile(this, options)
return options.outWidth
}
fun String.getImageHeight(): Int {
val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
BitmapFactory.decodeFile(this, options)
return options.outHeight
}
fun String.getImageMimeType(): String {
val options = BitmapFactory.Options()
options.inJustDecodeBounds = true
BitmapFactory.decodeFile(this, options)
return options.outMimeType ?: ""
}