1

我在单击按钮时在我的应用程序中打开默认相机。当我单击按钮时,它工作正常。但它捕获默认大小的图像,我想在捕获图像后重新调整图像大小,然后将其保存在 SD 卡中默认相机。

4

3 回答 3

3

使用以下代码为相机意图设置适当的宽度和高度。

            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 );
于 2012-10-08T11:07:03.660 回答
0

我认为这必须对您有所帮助:-

Bitmap.createScaledBitmap(Bitmap src, int dstWidth, int dstHeight, boolean filter);
于 2012-10-08T11:06:30.500 回答
0
    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);
于 2016-04-26T04:38:28.600 回答