【发布时间】:2011-12-11 13:37:38
【问题描述】:
我有一个图像的 Uri,该图像是从图库中获取或选择的,我想加载并压缩为 75% 质量的 JPEG。我相信我已经通过以下代码实现了这一点:
ByteArrayOutputStream bos = new ByteArrayOutputStream();
Bitmap bm = BitmapFactory.decodeFile(imageUri.getPath());
bm.compress(CompressFormat.JPEG, 60, bos);
并不是我把它塞进了一个名为bos 的ByteArrayOutputStream 中,我需要将它添加到MultipartEntity 中,以便HTTP POST 将它添加到一个网站。 我不知道如何将 ByteArrayOutputStream 转换为 FileBody。
【问题讨论】:
标签: android image upload http-post