发送后获得低质量图像

时间:2016-03-24 08:43:20

标签: java android bitmap

这里的问题是当我将图像发送到服务器时,它会发送非常低质量的图像,如imageview中显示的那样,即使压缩后如何发送更好的质量?

bitmap1是压缩后将保存位图的字符串

private void takeImage() {

    Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
    intent.putExtra(MediaStore.EXTRA_OUTPUT, selectedImage);
    if (intent.resolveActivity(getPackageManager()) != null) {
        startActivityForResult(intent, REQUEST_IMAGE_CAPTURE);
    }
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {


    if (requestCode == REQUEST_IMAGE_CAPTURE && resultCode == RESULT_OK) {
        selectedImage = data.getData();
        photo = (Bitmap) data.getExtras().get("data");


        Bitmap photo = (Bitmap) data.getExtras().get("data");
        imageView.setImageBitmap(photo);

    }
}

....



ByteArrayOutputStream bao = new ByteArrayOutputStream();
            photo.compress(Bitmap.CompressFormat.JPEG, 100, bao);
            bitmap1 = Base64.encodeToString(bao.toByteArray(), Base64.DEFAULT);

0 个答案:

没有答案