Wednesday 17 September 2014

Converting Bitmap to Byte Array in Android

public byte[] convertBitmapToByteArray(Bitmap bitmap)
    {
        ByteArrayOutputStream stream = new ByteArrayOutputStream();

        bitmap.compress(Bitmap.CompressFormat.PNG, 100, stream);

        byte[] bitmapData = stream.toByteArray();

        return bitmapData;
    }

No comments:

Post a Comment