Java can';不能降低位图分辨率
您好,这个问题可能有点长,但我会解释所有的事情 得到了我已经尝试过的代码 我在里面有一个应用程序有一个按钮内容:Java can';不能降低位图分辨率,java,android,bitmap,Java,Android,Bitmap,您好,这个问题可能有点长,但我会解释所有的事情 得到了我已经尝试过的代码 我在里面有一个应用程序有一个按钮内容: try{ Intent Intent1 = new Intent(MainActivity.this , TheSsecondClass2.class); Intent1.putExtra("bitmapsent", ImageMap); // from user gallery or camera startActivityForResult(Intent1, 3); } 然
try{
Intent Intent1 = new Intent(MainActivity.this , TheSsecondClass2.class);
Intent1.putExtra("bitmapsent", ImageMap); // from user gallery or camera
startActivityForResult(Intent1, 3);
}
然后应用程序使“在新活动中”imageview
等于ImageMap
,并使用以下代码缩放imageview
:
Captured.setImageBitmap(ImageMap);
Captured.getLayoutParams().height = 1400;
Captured.getLayoutParams().width = 1200;
然后用户对其进行一点编辑,然后在完成时使用按钮返回结果\u OK
,其代码为:
overlay(Background, currentleft, currentright, currentTop,currentBottom);
// getting things back when the safr"startactivityforresult" starts
Intent IntentBack = new Intent(TheSsecondClass2.this , MainActivity.class);
IntentBack.putExtra("returnedbitmap", bmOverlay);
IntentBack.putExtras(IntentBack);
setResult(RESULT_OK , IntentBack);
finish();
overlay
方法返回位图bmoverlay
是用于编辑目的(如编辑左、右)的位图的混合体
底部、顶部和背景或主图片位图合并到一个图像中的问题,一切都很好,但问题是
即使将位图添加到gallery中,位图也会变大并脱离图像视图的边缘,我尝试使用以下方法缩放它:
ScaledBit = Bitmap.createScaledBitmap(ImageMap, 1, 1, true);
ScaledBit = ImageMap;
使用-1或更大的数字,但这就像把它放大了千倍左右。
并尝试了以下两种代码:
CapturedImage.setMaxHeight(200);
CapturedImage.setMaxHeight(200);
Bitmap.setwidth();
Bitmap.setHeight();
我可能会使用更多,但我忘记了,所有变量声明如下:
Bitmap ImageMap;
ImageView CapturedImage;
static Bitmap currentright,currentleft,currentTop,currentBottom;
static Bitmap bmOverlay ,background;
api级别11。
请帮助并感谢您。您创建了ScaledBit,然后立即覆盖它?这是:ScaledBit=ImageMap;您刚刚用原始ImageMap覆盖了以前的缩放位