2020 Apr. 26.
2020 Mar. 21.
// Prepare myBmp of Bitmap before the codes below. // BitMap -> ByteArrayOutputStream -> JPEG byte[] byteArrayMyImage; // prepare instance of ByteArray on memory to store finished JPEG ByteArrayOutputStream outStream = new ByteArrayOutputStream(); // prepare instance of OutputStream in ByteArray myBmp.compress(Bitmap.CompressFormat.JPEG, 80, outStream); // convert BitMap to OutputStream in ByteArray byteArrayMyImage = outStream.toByteArray(); // convert OutputStream to ByteArray on memory