You can use Bitmap
s createScaledBitmap()
as explained e.g. here
How about this one: How to Resize a Bitmap in Android?
EDIT - Sending bitmap to server
A bitmap in memory is quite large as it is not compressed like a PNG or JPEG, instead for every pixel you need 3 or even 4 bytes of memory. Thus you'll want to convert that bitmap into e.g. an PNG before uploading. This can be done with the Bitmap.compress(...) method, which requires an OutputStream to write the compressed image to. As you do not want to save the image to SD card before uploading, you can use an ByteArrayOutputStream
instead to keep the compressed image in memory.
Then, you can attach an ByteArrayInputStream
to the bytes written and pass that to loopj.
In code this should look something like so:
ByteArrayOutputStream outStream = new ByteArrayOutputStream();
b.compress(Bitmap.CompressFormat.PNG, quality, outStream);
ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
/* ...and then pass inStream loopj */