convertToJpeg

fun convertToJpeg(photo: ByteArray, quality: Int): ByteArray?

Converts non-JPEG images to JPEG (compression: 75). Does nothing if image is already in JPEG format.

Return

same image in JPEG format or null if image couldn't be converted

Parameters

photo

image in format that can be read by BitmapFactory

quality

JPEG quality (ignored when photo is already in JPEG format)