裁剪位图图像 [英] Crop a Bitmap image

查看:135
本文介绍了裁剪位图图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何裁剪位图图像?这是我的问题,我已经尝试过使用意向的一些概念,但仍不能..

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

这篇关于裁剪位图图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆