The advantage of using Leia Image Format is its ability to appear as a regular image on a normal device. The Android Media SDK provides an easy-to-use MultiviewImageEncoder to encode a Multiview Image to a LIF.
Using the Multiview Image Encoder
You can obtain an instance of the MultiviewImageEncoder using the getDefault() function.
This will handle all the encoding for the ViewPoints, disparity and the global metadata of the MultiviewImage. After encoding, it will return the MultiviewImage as raw bytes. You can use these bytes to easily write to a FileOutputStream.
Optionally, you can also use the overloaded function to tweak the JPEG image quality percentage while encoding. By default, the encoder encodes at 100% quality, if not specified.
val encoder = MultiviewImageEncoder.getDefault()
val encodedBytes = encoder.encode(multiviewImage,70)// 70% quality