My name is Ryan and I am a full stack software engineer with great passion on Flutter.
- 🔭 I’m currently working on Wren, a Flutter app for birders to view & listen to bird recordings.
The Ultimate Approach to crop photos on android devices, especially for large size photos. This way can help you avoid OOM(OutOfMemory) exception.
My name is Ryan and I am a full stack software engineer with great passion on Flutter.
从相册裁剪无法返回正常的数据 会卡在哪
在三星手机上调用系统拍照后会发现获取不到图片,进入裁剪图片后显示无法加载,原因是三星手机拍照完毕后由于切换了横竖屏会销毁Activity,从而丢失数据。解决办法就是在拍照的Activity里加上android:configChanges="orientation|keyboardHidden|screenSize",测试通过,完美解决。
有计划支持Android 7.0的FileProvider吗?
b kh
hi
sample worked best but in the my app not work
and log :
08-31 13:39:53.585: E/MainActivity(31019): requestCode = 3
08-31 13:39:53.585: E/MainActivity(31019): resultCode = 0
08-31 13:39:53.585: E/MainActivity(31019): data = null
can help me?
设备:华硕平板ZenPad8.0 Z380K1 安卓5.0.1
private static Intent buildCropIntent(String action, CropParams params) {
return new Intent(action)
.setDataAndType(params.uri, params.type)
....
.putExtra(MediaStore.EXTRA_OUTPUT, params.uri);
}
应该是此处输入和输出的两个uri使用了相同的值,导致在生成裁剪图片时出错了
最新的AS项目中是用mipmap管理资源文件,所以如果用mipmap管理资源文件的项目引入此依赖包,会报错!
@ryanhoo
I'm using the cropper inside the fragment !
but on pressing save button after cropping, the image doesn't come in the imageview but onCacelled is called all the time !
Any Solutions ?
使用该剪裁库,选择拍照后,无法正常跳转到图片剪裁界面,调用系统相册,剪裁后点击保存按钮,未获取到剪裁后的图片地址。
之所以在部分手机上出现截图后直接返回cancle的回调是因为截图时源路径和目标路径一致导致的,解决办法就是截图的intent里设置源路径和目标路径不一致即可。亲测可用。
mImageView.setImageBitmap(BitmapUtil.decodeUriAsBitmap(this, uri));
mImageView.setImageURI(uri);
魅族的调图库选图片,之后,页面上一直在转
Exception Log :
java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=131199, result=-1, data=Intent { dat=content://com.google.android.apps.photos.contentprovider/2/1/mediakey:/local%3Aa217d8f6-cd10-452f-b2b8-c7af2191b735/ORIGINAL/NONE/1020215141 flg=0x1 launchParam=MultiScreenLaunchParams { mDisplayId=0 mFlags=0 } clip={text/uri-list U:content://com.google.android.apps.photos.contentprovider/2/1/mediakey%3A%2Flocal%253Aa217d8f6-cd10-452f-b2b8-c7af2191b735/ORIGINAL/NONE/1020215141} }} to activity {com.test.MainActivity}: java.lang.NullPointerException
Look at this post No, Android Does Not Have a Crop Intent
Many developers are calling startActivity() on an Intent with an action of com.android.camera.action.CROP. They are doing this to crop an image.
This is a really bad idea.
Any time you find yourself typing or pasting something starting with com.android, warning bells should be sounding. Better yet, the “Lost in Space” Robot should amble toward you, waving his arms, shouting “Danger, Will Robinson! Danger!”
(note: while your name may not be Will Robinson, if a robot is flailing about in your vicinity, just play along, m’kay?)
In this specific case, this Intent action is supported by the AOSP Camera app. That app does not exist on all devices. Devices lacking this app will not respond to this undocumented Intent action, and your app will crash.
There are several open source libraries for cropping images in Android. I have not tried any of them, and therefore cannot vouch for how well any work. However, they are safer bets than relying upon an undocumented Intent action from an app that may not exist on any given user’s device.
It seems that using the so called System Crop Action: com.android.camera.action.CROP
is not a wise choice.
首先:小米NOTE标准版正常,6.0系统。小米NOTE高配版5.1系统,崩溃。
nexus5原生机(真机)6.0系统,选择图片后没有跳转到裁剪activity而直接返回成功。
魅族MX5 5.1系统相册选取永远返回已取消。
在fragment使用的时候,拍照返回获取不到剪切完的返回路径。
getContext in android.support.v4.app.Fragment has clashes with getContext in CropHandler.The same problem is android.app.Fragment
All crops fail.
Example
onFailed() called with: message = [Returned data is null Intent { act=file:///storage/1C13-3810/PhotoCropper/image-1451340172698.jpg (has extras) }]
Solution:
http://stackoverflow.com/questions/9890757/android-camera-data-intent-returns-null
@ryanhoo
On cropping the image, the size of the image returned is thumbnail size image.
how to get full size image ?
首先先谢谢po主。
然后问题:
拍照第一次可正常获得图片并可以crop
但事不退出应用 再次使用,则会导致无法获得图片。crop时显示一片灰色
在魅族的机上选择相册不能到裁剪图片的页面
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.