I am opening a default Camera in my app on button click.when i click on button ,it works fine.But it capture the image of default size and I want to re-size the image before save it in SD card after capture it from default camera.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Use the following piece of code to set proper width and height for camera intent.
Intent intent = new Intent( Intent.ACTION_PICK,
MediaStore.Images.Media.INTERNAL_CONTENT_URI );
intent.putExtra("outputX",
width_of_output_image);
intent.putExtra("outputY",
height_of_output_image);
intent.putExtra("aspectX", 1);
intent.putExtra("aspectY", 1);
intent.putExtra( "scale", true );
startActivityForResult( intent, 1 );
回答2:
use this link, that can help you
Android take photo and resize it before saving on sd card
回答3:
I think this must help you:-
Bitmap.createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter);
回答4:
BitmapFactory.Options optionsSignature = new BitmapFactory.Options();
final Bitmap bitmapSignature = BitmapFactory.decodeFile(
fileUriSignature.getPath(), optionsSignature);
Bitmap resizedSignature = Bitmap.createScaledBitmap(
bitmapSignature, 256, 128, true);
signature.setImageBitmap(resizedSignature);