2010-08-20 197 views

回答

0

您可以使用Base64编码的Android类:

String encodedImage = Base64.encodeToString(byteArrayImage, Base64.DEFAULT); 

你有你的图像转换为字节数组,虽然。这里有一个例子:

Bitmap bm = BitmapFactory.decodeFile("/path/to/image.jpg"); 
ByteArrayOutputStream baos = new ByteArrayOutputStream(); 
bm.compress(Bitmap.CompressFormat.JPEG, 100, baos); //bm is the bitmap object 
byte[] b = baos.toByteArray(); 
相关问题