问题描述
我开发的应用程序在那里我要裁剪从相机拍摄的图像,并上传到SFTP服务器。我使用下面的code作物图像:
I am developing app where i want to crop image taken from camera and upload to sftp server.I am using following code to crop image:
BitmapFactory.Options opts = new BitmapFactory.Options();
opts.inSampleSize = 1;
Bitmap bm = BitmapFactory.decodeFile(imagePath, opts);
Intent intent = new Intent("com.android.camera.action.CROP");
intent .setDataAndType(outputFileUri, "image/*");
intent.putExtra("outputX",bm.getWidth());
intent.putExtra("outputY", bm.getHeight());
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra("scale", true);
intent.putExtra("return-data", false);
startActivityForResult(intent, 2);
有了这个,我得到一个可调整大小的矩形。不过,虽然调整裁剪区域的宽度和高度都改变proprtionally这样。
With this I am getting a resizable rectangle. But while resizing cropped area width and height are changing proprtionally like this .
我想改变宽度和裁剪区域的高度独立像的
I want to change width and height of cropped area independently like in PhotoCrop app
我希望你明白我的问题。
I hope you have understand my problem.
编辑:* 同时图像裁剪是不工作的三星galaxy S3和另一件事是,当我调整种植面积,它是缩放图像过多和形象越来越模糊。的*
*Also image cropping is not working on Samsung galaxy S3 and another thing is that when i resize cropping area, it is zooming the image too much and image is getting blur..*
推荐答案
试试这个:
intent.putExtra("aspectX", 0);
intent.putExtra("aspectY", 0);
希望它可以帮助你。
Hope it helps you.
感谢。
这篇关于Android的 - 裁剪图像取自相机可调整大小的,独立的高度和宽度裁剪区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!