gpt4 book ai didi

android - 如何在我的应用程序中编辑通过相机拍摄的照片?

转载 作者:行者123 更新时间:2023-11-29 01:55:56 25 4
gpt4 key购买 nike

在我的应用程序中,我使用相机拍照。
我使用此代码启动相机 Activity :

Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
timeStamp = new SimpleDateFormat("yyyyMMddHHmmss").format(new Date());
File file = new File(directory, timeStamp+".png"); //name
Uri outputFileUri1 = Uri.fromFile(file);
intent.putExtra(MediaStore.EXTRA_OUTPUT, outputFileUri1);
startActivityForResult(intent, CAMERA_RESULT);

此代码有效,但如何在我的主 Activity 在 onActivityResult() 中获取数据之前编辑预览图像(裁剪、旋转...)?
或者如何从我的应用程序启动图像的照片编辑器?

最佳答案

你应该创建一个 Bitmap图像中的对象,然后您可以对其进行操作。

String fooFile = "PATH TO FILE";
Bitmap bmp = BitmapFactory.decodeFile(fooFile);

这里是裁剪example .有关更多示例,请仅在 Google 上搜索“Bitmap manipulation android”

关于android - 如何在我的应用程序中编辑通过相机拍摄的照片?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15142761/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com