发布小分辨率的非常小的位图

时间:2016-03-21 11:59:21

标签: android bitmap

这里有问题,当通过凌空发布字符串位图时它会发布小分辨率的非常小的图像,虽然我设置100为质量

    private void takeImage() {
        Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        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");

            String[] filepath = {MediaStore.Images.Media.DATA};

            Cursor cursor = getContentResolver().query(selectedImage, filepath, null, null, null);
            cursor.moveToFirst();

            int columnIndex = cursor.getColumnIndex(filepath[0]);
            picturePath = cursor.getColumnName(columnIndex);
            cursor.close();

            Bitmap photo = (Bitmap) data.getExtras().get("data");
            imageView = (ImageView) findViewById(R.id.tokenImage);
            imageView.setImageBitmap(photo);

        }
    }


......


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

=============================================== =======

1 个答案:

答案 0 :(得分:0)

您已发送多部分请求,其描述如下: MultipartPostRequest

但正如@thepoosh所提到的,凌空不是最好的选择。