Java 剪切图像并将其发送到服务器后,图像的质量是否会变差?

Java 剪切图像并将其发送到服务器后,图像的质量是否会变差?,java,android,image,camera,Java,Android,Image,Camera,我不知道,问题是剪切函数还是解码码 我使用代码上传: public void Upload(View view) { Bitmap Bimg = ((BitmapDrawable) image1.getDrawable()).getBitmap(); ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream(); Bimg.compress(Bitmap.CompressFo

我不知道,问题是剪切函数还是解码码 我使用代码上传:

public void Upload(View view) {
Bitmap Bimg = ((BitmapDrawable) image1.getDrawable()).getBitmap(); 
        ByteArrayOutputStream byteArrayOutputStream = new  ByteArrayOutputStream();
        Bimg.compress(Bitmap.CompressFormat.JPEG, 100, byteArrayOutputStream);
          // Bimg.compress(Bitmap.CompressFormat.PNG, 100, byteArrayOutputStream); // bad too
         encodimg =  Base64.encodeToString(byteArrayOutputStream.toByteArray(), Base64.DEFAULT);
我用这个代码来剪切图像:

private void performCrop(){ 
    try {

        Intent cropIntent = new Intent("com.android.camera.action.CROP");

        cropIntent.setDataAndType(picUri, "image/*");

        cropIntent.putExtra("crop", "true");

        cropIntent.putExtra("aspectX", 1);
        cropIntent.putExtra("aspectY", 1);

        cropIntent.putExtra("outputX", 512);
        cropIntent.putExtra("outputY", 512);


        cropIntent.putExtra("return-data", true);

        startActivityForResult(cropIntent, PIC_CROP);
        Toast toast = Toast.makeText(this, "Done", Toast.LENGTH_SHORT);
    }
    catch(ActivityNotFoundException anfe){

        String errorMessage = "Soory - your device doesn't support the crop action!";
        Toast toast = Toast.makeText(this, errorMessage, Toast.LENGTH_SHORT);
        toast.show();
    }

}
备注:我使用xml中的小图像作为小预览:

<ImageView
            android:onClick="Load_Picture"
            android:id="@+id/imageview1"
            android:background="@drawable/default_img"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" />
问题是剪切方法,因为如果我在剪切之前上传位图,我会得到非常好的质量。所以问题是:

performCrop(){ 

您没有尝试将剪切的图像发送到服务器

而是在imageview中显示裁剪后的图像。然后,从该imageview获取屏幕转储并将其上载到服务器。当然,帽子的质量很差

相反,您应该上传从裁剪功能获得的图像


请比较所有相关图像的分辨率(以像素为单位)。

我们看不到您如何处理裁剪后的图像。
我使用代码上载:
该代码未上载。
是剪切功能还是解码代码的问题。
。你是说作物功能?以及编码?例如:
cropIntent.putExtra(“outputX”,2028);cropIntent.putExtra(“outputY”,1152)只有在拍摄前尽可能放大图像最大值,或者通过剪切,我才可以获得良好的质量。我应该选择较小的空间,否则质量会很差。是的,我从imageview获得位图作为屏幕截图。如何直接从数据中获取数据?这是我的代码:
@Override protected void onActivityResult(int-requestCode,int-resultCode,Intent-data){super.onActivityResult(requestCode,resultCode,data);if(requestCode==111&&resultCode==RESULT\u OK){//Uri Uri=data.getData();//imageView.setImageURI(Uri);imageView.setImageBitmap((Bitmap)data.getExtras().get(“data”);}
我不会尝试在注释中解码代码。把你的代码放在你的帖子里,给出我想要的信息。请检查上面的两张图片,为什么如果我选择小空间我会得到好的质量?你仍然没有发布我想要的像素分辨率。我使用高分辨率的前置摄像头。但如果问题是分辨率,为什么从Galerie的存储器中选择图片会出现同样的问题呢。检查我添加的分辨率图像
performCrop(){