Hi all,

I'm trying to compress an Image using Bitmap.compress().
As you know it has 3 parameters, in which the second one is
quality(int).

If follow the code, you may find serverMax var which sets the max
size, basically send from server.
Now my issue is, whatever the size of Image I want to set my Image
size according to serverMax.
Since it is not the percentage, please help to calculate.

int serverMax = 10240;
                final String photoString = new
String(Base64.encodeBase64(data));
                if (photoString.length() > 0) {
                    Log.i("VCardComposer", "Photo size = " +
String.valueOf(photoString.length()));
                    if (photoString.length() > serverMax) {
                        // My Code - BEGIN
                        Bitmap mPhoto =
BitmapFactory.decodeByteArray(data, 0, data.length);
                        ByteArrayOutputStream stream = new
ByteArrayOutputStream();
 
mPhoto.compress(Bitmap.CompressFormat.valueOf(photoType), 50, stream);
                        Log.i("VCardComposer", "stream = " +
String.valueOf(stream.size()));
                    }

Thanks in advance.
Your patience & time are appreciated.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to