Unable to crop large images

My application should open the gallery and select the image to crop. I set the target size as a value (87% * screenWide). Now there are problems. On large screen devices, the gallery was unable to return the cropped image, and the magazine said, "!!! TRANSACTION TRANSACTION MALFUNCTION !!!". On most devices, this is normal.

Can someone help me with this? Thanks!

I use Intent.ACTION_GET_CONTENT to trim and set outputX, outputY, etc. This is a cropping routine.

+4
source share
3 answers

Ask the wallpaper problem, try installing explicitly:

your_intent.putExtra("setWallpaper", false); 
+1
source

I had a similar problem. If you use the default crop tool for Android, it has a max size limit. 256x256. Set the size of your crop to less or equal to it, and everything will be fine.

 intent.putExtra("outputX", 256); intent.putExtra("outputY", 256); 
+7
source

Try sending the intent as shown below:

 mSavedUri = Uri.fromFile(new File("/sdcard/cropped.jpg")); mImageSelectIntent = new Intent(Intent.ACTION_GET_CONTENT, null); mImageSelectIntent.setType("image/*"); mImageSelectIntent.putExtra("crop", "true"); mImageSelectIntent.putExtra("aspectX", 4); mImageSelectIntent.putExtra("aspectY", 3); mImageSelectIntent.putExtra("outputX", mImageWidth); mImageSelectIntent.putExtra("outputY", mImageHeight); mImageSelectIntent.putExtra("output", mSavedUri); 

The cropped image will be saved as a cropped JPG and will not be returned to you through the "data".

+6
source

Source: https://habr.com/ru/post/1333154/


All Articles