Image.kt 344 Bytes
Newer Older
1 2 3 4 5
package chat.rocket.android.util.extensions

import android.graphics.Bitmap

fun Bitmap.getCompressFormat(mimeType: String): Bitmap.CompressFormat {
6 7 8 9
    return when {
        mimeType.contains("jpeg") -> Bitmap.CompressFormat.JPEG
        mimeType.contains("webp") -> Bitmap.CompressFormat.WEBP
        else -> Bitmap.CompressFormat.PNG
10 11
    }
}