由网友(黑色轮廓の泛白记忆)分享简介:如何裁剪位图图像?这是我的问题,我已经尝试过使用意向的一些概念,但仍不能.. How can i crop a bitmap image? this is my question i have tried some concepts using intents but still fail..我有,我要裁剪!!位...
如何裁剪位图图像?这是我的问题,我已经尝试过使用意向的一些概念,但仍不能..
How can i crop a bitmap image? this is my question i have tried some concepts using intents but still fail..
我有,我要裁剪!!位图图像
I am having a bitmap image which i want to crop!!
这里是code:
Intent intent = new Intent("com.android.camera.action.CROP");
intent.setClassName("com.android.camera", "com.android.camera.CropImage");
File file = new File(filePath);
Uri uri = Uri.fromFile(file);
intent.setData(uri);
intent.putExtra("crop", "true");
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("outputX", 96);
intent.putExtra("outputY", 96);
intent.putExtra("noFaceDetection", true);
intent.putExtra("return-data", true);
startActivityForResult(intent, REQUEST_CROP_ICON);
可能有人帮我对此@Thanks
Could anybody help me regarding this @Thanks
推荐答案
我用这个方法来裁剪图像和它的作品完美的:
I used this method to crop the image and it works perfect:
Bitmap bmp=BitmapFactory.decodeResource(getResources(), R.drawable.xyz);
resizedbitmap1=Bitmap.createBitmap(bmp, 0,0,yourwidth, yourheight);
createBitmap()需要的位图,启动X,启动Y,宽度和放大器;高度参数
createBitmap() takes bitmap,start X,start Y,width & height as parameter
相关推荐
最新文章